@opencraw/driver 0.7.9 → 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,8 +0,0 @@
1
- import type { RecordSink } from '@opencraw/core';
2
- /**
3
- * The sink of a run with no `out` file: it keeps nothing, since each record already reached the client
4
- * as a `record` notification from its `record:emit` event, and only counts them for the report. A long
5
- * crawl therefore streams in constant memory.
6
- */
7
- export declare function streamingSink(): RecordSink;
8
- //# sourceMappingURL=streaming-sink.repository.d.ts.map
@@ -1,3 +0,0 @@
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
@@ -1,26 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- export { probeSite } from './probe-site.use-case.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,13 +0,0 @@
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
@@ -1,5 +0,0 @@
1
- export { openLineChannel } from './line-channel.client.js';
2
- export type { LineChannel, RequestHandler } from './line-channel.client.js';
3
- export { RPC_ERRORS, RpcFailure } from './json-rpc.contract.js';
4
- export type { RpcError, RpcMessage } from './json-rpc.contract.js';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,31 +0,0 @@
1
- /** JSON-RPC 2.0 error codes the driver answers with. */
2
- export declare const RPC_ERRORS: {
3
- readonly parse: -32700;
4
- readonly invalidRequest: -32600;
5
- readonly methodNotFound: -32601;
6
- readonly invalidParams: -32602;
7
- readonly internal: -32603;
8
- /** A failure the caller must act on: the message says what to do. */
9
- readonly server: -32000;
10
- };
11
- export interface RpcError {
12
- code: number;
13
- message: string;
14
- data?: unknown;
15
- }
16
- /** A request (it has an id and wants a response) or a notification (no id). */
17
- export interface RpcMessage {
18
- jsonrpc: '2.0';
19
- id?: number | string | null;
20
- method?: string;
21
- params?: unknown;
22
- result?: unknown;
23
- error?: RpcError;
24
- }
25
- /** An error a method handler throws to answer with a code other than `server`. */
26
- export declare class RpcFailure extends Error {
27
- readonly code: number;
28
- readonly data: unknown;
29
- constructor(code: number, message: string, data?: unknown);
30
- }
31
- //# sourceMappingURL=json-rpc.contract.d.ts.map
@@ -1,27 +0,0 @@
1
- import type { Readable, Writable } from 'node:stream';
2
- /** Answers a request: its result, or a thrown error (an `RpcFailure` for a specific code). */
3
- export type RequestHandler = (method: string, params: unknown) => Promise<unknown>;
4
- /** JSON-RPC 2.0 both ways over a stream pair, one message per line. */
5
- export interface LineChannel {
6
- /** Sends a request to the other side and waits for its result; rejects with its error. */
7
- request: (method: string, params: unknown) => Promise<unknown>;
8
- /** Sends a notification: no answer is expected. */
9
- notify: (method: string, params: unknown) => void;
10
- /** Settles when the input ends (the other side closed it, or went away). */
11
- closed: Promise<void>;
12
- /** Settles once every request read so far has been answered: what to wait for before stopping. */
13
- drained: () => Promise<void>;
14
- }
15
- /**
16
- * Opens a channel: every line read from `input` is a JSON-RPC message. A request goes to `handle` and its
17
- * answer is written back; a response settles the matching `request`. A line that is not JSON gets a parse
18
- * error, a message without `jsonrpc: "2.0"` an invalid-request error, and nothing it does stops the channel.
19
- * Writes are one line each, never interleaved.
20
- *
21
- * @param input - Where messages arrive (the driver's stdin).
22
- * @param output - Where they go (the driver's stdout).
23
- * @param handle - What answers the other side's requests and notifications.
24
- * @returns The channel.
25
- */
26
- export declare function openLineChannel(input: Readable, output: Writable, handle: RequestHandler): LineChannel;
27
- //# sourceMappingURL=line-channel.client.d.ts.map
@@ -1,17 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- export { clientWorkSource } from './client-work-source.client.js';
2
- //# sourceMappingURL=index.d.ts.map