@opencraw/driver 0.5.0 → 0.6.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.
package/README.md CHANGED
@@ -60,6 +60,19 @@ stdin at once. Answers may arrive out of order; match them by `id`.
60
60
  `-32602` (bad params, the problems listed), `-32000` (a failure to act on: its message says what to do).
61
61
  - stdout carries protocol messages only. The driver's own logs go to stderr.
62
62
 
63
+ ## The runtime: no Node needed
64
+
65
+ Each driver release carries, as assets of its GitHub release `driver@<version>`, an archive per platform
66
+ (`win32-x64`, `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`): a Node binary, the driver and its
67
+ dependencies, and `runtime.json`, whose `command` starts it (both paths relative to the unpacked folder).
68
+ `driver-runtime.json` lists them with their SHA-256 and size; its schema is `schemas/driver-runtime.schema.json`
69
+ and `schemas/driver-runtime.fixture.json` is an example. A client downloads its platform's archive once, refuses
70
+ one whose hash does not match, unpacks it into a per-user cache and starts the driver from there.
71
+
72
+ `node packages/driver/packaging/stage-runtime.mjs` builds this platform's archive into `dist/drop/driver-runtime`
73
+ (after `smith build -p driver`), and starts the staged driver once with `PATH` emptied, to prove it needs nothing
74
+ else. Browsers are not in it: they are installed through the driver, the Playwright way.
75
+
63
76
  ## Development
64
77
 
65
78
  `smith run lint typecheck test build -p driver`. After changing a contract in `src/protocol/`, run
package/dist/index.esm.js CHANGED
@@ -575,10 +575,35 @@ async function serveDriver(input, output, identity) {
575
575
  await channel.drained();
576
576
  await sessions.closeAll();
577
577
  }
578
+
579
+ // src/runtime-manifest/runtime-manifest.contract.ts
580
+ import { z as z3 } from "zod";
581
+ var RUNTIME_PLATFORMS = ["win32-x64", "darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"];
582
+ var archiveSchema = z3.strictObject({
583
+ /** The archive's file name, an asset of the same GitHub release as the manifest. */
584
+ file: z3.string().regex(/^opencraw-driver-[\w.-]+\.tar\.gz$/),
585
+ /** Its SHA-256, lowercase hex: a client refuses an archive that does not match. */
586
+ sha256: z3.string().regex(/^[0-9a-f]{64}$/),
587
+ size: z3.number().int().positive()
588
+ });
589
+ var runtimeManifestSchema = z3.strictObject({
590
+ driverVersion: z3.string().min(1),
591
+ protocolVersion: z3.string().regex(/^\d+\.\d+\.\d+$/),
592
+ /** The Node version every archive carries. */
593
+ node: z3.string().regex(/^v\d+\.\d+\.\d+$/),
594
+ archives: z3.partialRecord(z3.enum(RUNTIME_PLATFORMS), archiveSchema)
595
+ });
596
+
597
+ // src/runtime-manifest/runtime-manifest-json-schema.mapper.ts
598
+ import { z as z4 } from "zod";
599
+ function runtimeManifestJsonSchema() {
600
+ return { $id: "https://opencraw.dev/schemas/driver-runtime.schema.json", ...z4.toJSONSchema(runtimeManifestSchema, { target: "draft-2020-12" }) };
601
+ }
578
602
  export {
579
603
  MESSAGES,
580
604
  PROTOCOL_VERSION,
581
605
  RPC_ERRORS,
606
+ RUNTIME_PLATFORMS,
582
607
  RpcFailure,
583
608
  calloutParamsSchema,
584
609
  calloutResultSchema,
@@ -607,6 +632,8 @@ export {
607
632
  runParamsSchema,
608
633
  runResultSchema,
609
634
  runSessions,
635
+ runtimeManifestJsonSchema,
636
+ runtimeManifestSchema,
610
637
  serveDriver,
611
638
  streamingSink,
612
639
  validateParamsSchema,
@@ -2,6 +2,8 @@ export { serveDriver } from './server/index.js';
2
2
  export type { DriverIdentity } from './server/index.js';
3
3
  export { PROTOCOL_VERSION, MESSAGES, driverProtocolJsonSchema, initializeParamsSchema, initializeResultSchema, validateParamsSchema, validateResultSchema, runParamsSchema, runResultSchema, cancelParamsSchema, cancelResultSchema, eventParamsSchema, recordParamsSchema, finishedParamsSchema, calloutParamsSchema, calloutResultSchema, probeParamsSchema, probeResultSchema, diffParamsSchema, diffResultSchema, exportParamsSchema, exportResultSchema, workParamsSchema, workItemSchema, workNextParamsSchema, workNextResultSchema, workDoneParamsSchema, workFailedParamsSchema, } from './protocol/index.js';
4
4
  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 './protocol/index.js';
5
+ export { RUNTIME_PLATFORMS, runtimeManifestSchema, runtimeManifestJsonSchema } from './runtime-manifest/index.js';
6
+ export type { RuntimeManifest, RuntimePlatform } from './runtime-manifest/index.js';
5
7
  export { openLineChannel, RPC_ERRORS, RpcFailure } from './transport/index.js';
6
8
  export type { LineChannel, RequestHandler, RpcError, RpcMessage } from './transport/index.js';
7
9
  export { runSessions, validateRecipes, streamingSink } from './session/index.js';
@@ -0,0 +1,4 @@
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
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,28 @@
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencraw/driver",
3
- "version": "0.5.0",
3
+ "version": "0.6.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",
@@ -0,0 +1,9 @@
1
+ {
2
+ "driverVersion": "0.6.0",
3
+ "protocolVersion": "1.2.0",
4
+ "node": "v24.12.0",
5
+ "archives": {
6
+ "linux-x64": { "file": "opencraw-driver-0.6.0-linux-x64.tar.gz", "sha256": "697d28005ed87b2887cf79edca25f06da89ab19bcb48f49c0a67dbdbcb004ad7", "size": 65410362 },
7
+ "win32-x64": { "file": "opencraw-driver-0.6.0-win32-x64.tar.gz", "sha256": "0f1e2d3c4b5a69788796a5b4c3d2e1f00f1e2d3c4b5a69788796a5b4c3d2e1f0", "size": 66120448 }
8
+ }
9
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$id": "https://opencraw.dev/schemas/driver-runtime.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "type": "object",
5
+ "properties": {
6
+ "driverVersion": {
7
+ "type": "string",
8
+ "minLength": 1
9
+ },
10
+ "protocolVersion": {
11
+ "type": "string",
12
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
13
+ },
14
+ "node": {
15
+ "type": "string",
16
+ "pattern": "^v\\d+\\.\\d+\\.\\d+$"
17
+ },
18
+ "archives": {
19
+ "type": "object",
20
+ "propertyNames": {
21
+ "type": "string",
22
+ "enum": [
23
+ "win32-x64",
24
+ "darwin-arm64",
25
+ "darwin-x64",
26
+ "linux-x64",
27
+ "linux-arm64"
28
+ ]
29
+ },
30
+ "additionalProperties": {
31
+ "type": "object",
32
+ "properties": {
33
+ "file": {
34
+ "type": "string",
35
+ "pattern": "^opencraw-driver-[\\w.-]+\\.tar\\.gz$"
36
+ },
37
+ "sha256": {
38
+ "type": "string",
39
+ "pattern": "^[0-9a-f]{64}$"
40
+ },
41
+ "size": {
42
+ "type": "integer",
43
+ "exclusiveMinimum": 0,
44
+ "maximum": 9007199254740991
45
+ }
46
+ },
47
+ "required": [
48
+ "file",
49
+ "sha256",
50
+ "size"
51
+ ],
52
+ "additionalProperties": false
53
+ }
54
+ }
55
+ },
56
+ "required": [
57
+ "driverVersion",
58
+ "protocolVersion",
59
+ "node",
60
+ "archives"
61
+ ],
62
+ "additionalProperties": false
63
+ }