@opencraw/driver 0.1.0 → 0.3.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.
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  * The driver protocol's version, separate from the package's: a client pins a major and the driver refuses
4
4
  * another. Additions (methods, optional fields) raise the minor; anything a client could break on, the major.
5
5
  */
6
- export declare const PROTOCOL_VERSION = "1.0.0";
6
+ export declare const PROTOCOL_VERSION = "1.2.0";
7
7
  export declare const initializeParamsSchema: z.ZodObject<{
8
8
  clientName: z.ZodString;
9
9
  clientVersion: z.ZodString;
@@ -35,6 +35,9 @@ export declare const validateResultSchema: z.ZodObject<{
35
35
  }, z.core.$strict>;
36
36
  export type ValidateResult = z.infer<typeof validateResultSchema>;
37
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>>;
38
41
  paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
42
  recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
40
43
  only: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -49,11 +52,37 @@ export declare const runParamsSchema: z.ZodObject<{
49
52
  ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
50
53
  }, z.core.$strict>>;
51
54
  hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
+ captchaSolvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
56
  }, z.core.$strict>;
53
57
  export type RunParams = z.infer<typeof runParamsSchema>;
54
58
  export declare const runResultSchema: z.ZodObject<{
55
59
  runId: z.ZodString;
56
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>;
57
86
  export type RunResult = z.infer<typeof runResultSchema>;
58
87
  export declare const cancelParamsSchema: z.ZodObject<{
59
88
  runId: z.ZodString;
@@ -63,7 +92,95 @@ export declare const cancelResultSchema: z.ZodObject<{
63
92
  cancelled: z.ZodBoolean;
64
93
  }, z.core.$strict>;
65
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>;
66
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>;
67
184
  /** Every crawl event, as core reports it (`CrawlEvent`); its shape is core's, versioned with core. */
68
185
  export declare const eventParamsSchema: z.ZodObject<{
69
186
  runId: z.ZodString;
@@ -83,7 +200,7 @@ export declare const finishedParamsSchema: z.ZodObject<{
83
200
  error: z.ZodOptional<z.ZodString>;
84
201
  }, z.core.$strict>;
85
202
  export type FinishedParams = z.infer<typeof finishedParamsSchema>;
86
- /** A hook the client serves: core's own callout request, answered with core's callout response. */
203
+ /** A hook, captcha solver or access plugin the client serves (`request.kind`): core's own callout request, answered with core's callout response. */
87
204
  export declare const calloutParamsSchema: z.ZodObject<{
88
205
  runId: z.ZodString;
89
206
  request: z.ZodObject<{
@@ -153,6 +270,9 @@ export declare const MESSAGES: {
153
270
  readonly run: {
154
271
  readonly direction: 'client-to-driver';
155
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>>;
156
276
  paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
277
  recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
158
278
  only: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -167,6 +287,31 @@ export declare const MESSAGES: {
167
287
  ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
168
288
  }, z.core.$strict>>;
169
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>]>>;
170
315
  }, z.core.$strict>;
171
316
  readonly result: z.ZodObject<{
172
317
  runId: z.ZodString;
@@ -181,6 +326,55 @@ export declare const MESSAGES: {
181
326
  cancelled: z.ZodBoolean;
182
327
  }, z.core.$strict>;
183
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
+ };
184
378
  readonly shutdown: {
185
379
  readonly direction: 'client-to-driver';
186
380
  readonly params: undefined;
@@ -220,6 +414,53 @@ export declare const MESSAGES: {
220
414
  retryAfterMs: z.ZodOptional<z.ZodNumber>;
221
415
  }, z.core.$strict>], "status">;
222
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
+ };
223
464
  readonly event: {
224
465
  readonly direction: 'driver-to-client';
225
466
  readonly params: z.ZodObject<{
@@ -1,4 +1,4 @@
1
- export { PROTOCOL_VERSION, MESSAGES, initializeParamsSchema, initializeResultSchema, validateParamsSchema, validateResultSchema, runParamsSchema, runResultSchema, cancelParamsSchema, cancelResultSchema, shutdownResultSchema, eventParamsSchema, recordParamsSchema, finishedParamsSchema, calloutParamsSchema, calloutResultSchema, } from './driver-message.contract.js';
2
- export type { InitializeParams, InitializeResult, ValidateParams, ValidateResult, RunParams, RunResult, CancelParams, CancelResult, EventParams, RecordParams, FinishedParams, CalloutParams, } from './driver-message.contract.js';
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
3
  export { driverProtocolJsonSchema } from './driver-json-schema.mapper.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,3 @@
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,5 +1,5 @@
1
1
  export { runSessions } from './run-session.use-case.js';
2
- export type { NotifyClient, RunSessions } from './run-session.use-case.js';
2
+ export type { RunSessions } from './run-session.use-case.js';
3
3
  export { validateRecipes, hooksOf, loadRecipes, sourceOf } from './recipe-loading.use-case.js';
4
4
  export { streamingSink } from './streaming-sink.repository.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,23 +1,23 @@
1
- import type { AskClient } from '../callout-bridge/index.js';
2
- import type { RunParams } from '../protocol/index.js';
3
- /** Sends a notification to the client. */
4
- export type NotifyClient = (method: string, params: unknown) => void;
1
+ import type { AskClient, NotifyClient } from '../callout-bridge/index.js';
2
+ import type { RunParams, WorkParams } from '../protocol/index.js';
5
3
  /** The runs a driver has going, by id, so `cancel` can reach them and `shutdown` close them all. */
6
4
  export interface RunSessions {
7
5
  start: (params: RunParams) => Promise<string>;
6
+ startWork: (params: WorkParams) => Promise<string>;
8
7
  cancel: (runId: string) => Promise<boolean>;
9
8
  closeAll: () => Promise<void>;
10
9
  }
11
10
  /**
12
- * Starts and tracks runs. `start` loads and binds the recipes (a bad recipe fails the `run` request
13
- * itself, with its problems), answers with a run id at once, and crawls in the background: every crawl
14
- * event goes to the client as an `event` notification, every record as a `record` one unless `out`
15
- * names a file, and the end as `finished` with the report. A hook the client serves is asked back with
16
- * a `callout` request. `cancel` closes the run's crawler, which stops its recipes; the run still ends
17
- * with `finished`.
11
+ * Starts and tracks runs and worker pools. `start` and `startWork` load and bind the recipes (a bad
12
+ * recipe fails the request itself, with its problems), answer with a run id at once, and crawl in the
13
+ * background: every crawl event goes to the client as an `event` notification, every record as a
14
+ * `record` one unless `out` names a file, and the end as `finished` with the report. A hook the client
15
+ * serves is asked back with a `callout` request, and so are the captcha solvers and access plugins it
16
+ * serves; a worker pool asks the client for its items (`work.next`). `cancel` closes the run's crawler,
17
+ * which stops its recipes; the run still ends with `finished`.
18
18
  *
19
19
  * @param notify - The channel's notify.
20
- * @param ask - The channel's request, for callouts.
20
+ * @param ask - The channel's request, for callouts and work.
21
21
  * @returns The sessions.
22
22
  */
23
23
  export declare function runSessions(notify: NotifyClient, ask: AskClient): RunSessions;
@@ -0,0 +1,3 @@
1
+ export { resolveSiteAccess } from './resolve-site-access.use-case.js';
2
+ export type { SiteAccess, SiteAccessParams } from './resolve-site-access.use-case.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,26 @@
1
+ import type { AccessConfig, AccessPlugin } from '@opencraw/core';
2
+ import type { AskClient } from '../callout-bridge/index.js';
3
+ /** What a run or a probe asks of access: the config file, the profile, and the plugins the client serves. */
4
+ export interface SiteAccessParams {
5
+ accessConfig?: string;
6
+ access?: string;
7
+ accessPlugins?: string[];
8
+ }
9
+ /** How a run or a probe reaches sites. */
10
+ export interface SiteAccess {
11
+ access?: AccessConfig;
12
+ accessPlugins: AccessPlugin[];
13
+ }
14
+ /**
15
+ * Loads the access config (the file the client names, else `OPENCRAW_ACCESS`), with `access` as its
16
+ * default profile, and builds a plugin for each one the client serves.
17
+ *
18
+ * @param params - The method's access fields.
19
+ * @param runId - The run, or the probe, the plugins' callouts belong to.
20
+ * @param ask - The channel's request.
21
+ * @param env - Where `OPENCRAW_ACCESS` is read.
22
+ * @returns The config and the plugins.
23
+ * @throws Error When a profile is named without a config, or the config has no such profile.
24
+ */
25
+ export declare function resolveSiteAccess(params: SiteAccessParams, runId: string, ask: AskClient, env?: NodeJS.ProcessEnv): Promise<SiteAccess>;
26
+ //# sourceMappingURL=resolve-site-access.use-case.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { probeSite } from './probe-site.use-case.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import type { AskClient } from '../callout-bridge/index.js';
2
+ import type { ProbeParams } from '../protocol/index.js';
3
+ /**
4
+ * Fetches a page, or renders it with `browser`, and says where its data lives: the probe the CLI and the
5
+ * MCP server use, through the access the client names (its plugins served by the client).
6
+ *
7
+ * @param params - The page and how to reach it.
8
+ * @param probeId - What the plugins' callouts carry as their `runId`.
9
+ * @param ask - The channel's request.
10
+ * @returns The probe's findings.
11
+ */
12
+ export declare function probeSite(params: ProbeParams, probeId: string, ask: AskClient): Promise<Record<string, unknown>>;
13
+ //# sourceMappingURL=probe-site.use-case.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { WorkSource } from '@opencraw/core';
2
+ import type { AskClient, NotifyClient } from '../callout-bridge/index.js';
3
+ /**
4
+ * A `WorkSource` whose items come from the client: each window that wants work sends a `work.next`
5
+ * request, which the client may hold until it has an item, and an answer of `null` ends the work. Each
6
+ * item's end goes back as `work.done` (with its records) or `work.failed`.
7
+ *
8
+ * A window that retires while its request is out (core aborts its `next`) still gets an answer later;
9
+ * that item is kept and handed to the next window that asks, so nothing the client sent is lost.
10
+ *
11
+ * @param runId - The work's run id, sent with every message.
12
+ * @param ask - The channel's request.
13
+ * @param notify - The channel's notify.
14
+ * @returns The source for `crawler.work`.
15
+ */
16
+ export declare function clientWorkSource(runId: string, ask: AskClient, notify: NotifyClient): WorkSource;
17
+ //# sourceMappingURL=client-work-source.client.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { clientWorkSource } from './client-work-source.client.js';
2
+ //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencraw/driver",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "OpenCraw's driver: the engine over JSON-RPC on stdio, for clients in other languages",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,8 +40,8 @@
40
40
  "schemas": "node tools/emit-protocol-schema.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@opencraw/cli": "^0.1.55",
44
- "@opencraw/core": "^0.2.0",
43
+ "@opencraw/cli": "^0.0.1",
44
+ "@opencraw/core": "^0.0.1",
45
45
  "zod": "^4.6.5"
46
46
  }
47
47
  }