@mochi.js/core 0.0.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 ADDED
@@ -0,0 +1,53 @@
1
+ # @mochi.js/core
2
+
3
+ > The primary entry point for **mochi** — a zero-footprint, Bun-native browser automation framework.
4
+
5
+ ```sh
6
+ bun add @mochi.js/core
7
+ ```
8
+
9
+ ```ts
10
+ import { mochi } from "@mochi.js/core";
11
+
12
+ const session = await mochi.launch({
13
+ profile: "mac-m2-chrome-stable",
14
+ seed: "user-12345",
15
+ });
16
+
17
+ const page = await session.newPage();
18
+ await page.goto("https://example.com");
19
+ await page.humanClick("#submit");
20
+ await session.close();
21
+ ```
22
+
23
+ ## Status
24
+
25
+ **v0.0.1 — claim release.** The surface above is the contract; the implementation lands incrementally per the project roadmap. Calling `mochi.launch()` at v0.0.1 throws `NotImplementedError` with a pointer to the repo.
26
+
27
+ The full surface lands in phases 0.1 → 1.0. Watch the repo for v0.1 (CDP transport) and v1.0 (the production release).
28
+
29
+ ## What this package gives you
30
+
31
+ - `mochi.launch(opts)` — spawn a Chromium-for-Testing instance with a relationally-locked fingerprint matrix derived from `(profile, seed)`.
32
+ - `Session` and `Page` — the runtime objects you drive.
33
+ - `page.humanClick / humanType / humanScroll` — biomechanically-shaped input synthesis.
34
+ - `session.fetch` — out-of-band requests with profile-matching JA3/JA4 via the Rust+wreq backend.
35
+
36
+ All of this is the single import. No mixing Patchright + a fingerprint injector + a Turnstile clicker. mochi solves it once.
37
+
38
+ ## Why @mochi.js/core?
39
+
40
+ - **Bun-only.** No Node fallback. Engines: `bun >= 1.1`.
41
+ - **Stock Chromium.** No patched fork. Works against [Chromium-for-Testing](https://googlechromelabs.github.io/chrome-for-testing/), pinned and downloadable via `mochi browsers install`.
42
+ - **Relational locking.** Every fingerprint surface (canvas, WebGL, audio, fonts, timing) derives from a single `(profile, seed)` pair. No Frankenstein fingerprints.
43
+ - **Zero-jitter spoofing.** TurboFan-friendly proxies installed via `Page.addScriptToEvaluateOnNewDocument(runImmediately:true)` before any page script. No async round-trips when a WAF probes.
44
+
45
+ ## License
46
+
47
+ MIT.
48
+
49
+ ## See also
50
+
51
+ - [Repo](https://github.com/0xchasercat/mochi.js)
52
+ - [PLAN.md](https://github.com/0xchasercat/mochi.js/blob/main/PLAN.md) — the full design contract
53
+ - [Limits](https://github.com/0xchasercat/mochi.js/blob/main/docs/limits.md) — what the JS-only ceiling honestly does and doesn't cover
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@mochi.js/core",
3
+ "version": "0.0.1",
4
+ "description": "Bun-native browser automation framework — relational fingerprint locking, zero-jitter injection, behavioral playback. The primary entry point.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./src/index.ts",
8
+ "types": "./src/index.ts",
9
+ "exports": {
10
+ ".": {
11
+ "bun": "./src/index.ts",
12
+ "types": "./src/index.ts",
13
+ "default": "./src/index.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "src",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "engines": {
22
+ "bun": ">=1.1"
23
+ },
24
+ "homepage": "https://github.com/0xchasercat/mochi.js",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/0xchasercat/mochi.js.git",
28
+ "directory": "packages/core"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/0xchasercat/mochi.js/issues"
32
+ },
33
+ "keywords": [
34
+ "browser",
35
+ "automation",
36
+ "chromium",
37
+ "cdp",
38
+ "bun",
39
+ "stealth",
40
+ "fingerprint",
41
+ "anti-bot",
42
+ "playwright-alternative",
43
+ "puppeteer-alternative"
44
+ ],
45
+ "scripts": {
46
+ "typecheck": "tsc --noEmit",
47
+ "test": "bun test src/",
48
+ "lint": "biome check src/",
49
+ "build": "echo 'no build step yet — Bun consumes src/ directly'"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ }
54
+ }
@@ -0,0 +1,20 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import { mochi, NotImplementedError, VERSION } from "../index";
3
+
4
+ describe("@mochi.js/core (claim release)", () => {
5
+ it("exports a VERSION string", () => {
6
+ expect(typeof VERSION).toBe("string");
7
+ expect(VERSION).toMatch(/^\d+\.\d+\.\d+/);
8
+ });
9
+
10
+ it("exports a mochi namespace with launch", () => {
11
+ expect(typeof mochi).toBe("object");
12
+ expect(typeof mochi.launch).toBe("function");
13
+ expect(mochi.version).toBe(VERSION);
14
+ });
15
+
16
+ it("mochi.launch throws NotImplementedError until phase 0.1", () => {
17
+ expect(() => mochi.launch()).toThrow(NotImplementedError);
18
+ expect(() => mochi.launch()).toThrow(/not yet implemented/);
19
+ });
20
+ });
package/src/index.ts ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @mochi.js/core — the Bun-native browser automation framework.
3
+ *
4
+ * This is a v0.0.1 claim release. The full surface — `mochi.launch()`, `Session`,
5
+ * `Page`, `humanClick`, `humanType`, `humanScroll` — lands incrementally per
6
+ * the implementation phases in PLAN.md (phase 0.1 → 1.0).
7
+ *
8
+ * @see https://github.com/0xchasercat/mochi.js
9
+ */
10
+
11
+ export const VERSION = "0.0.1" as const;
12
+
13
+ export class NotImplementedError extends Error {
14
+ constructor(public readonly api: string) {
15
+ super(
16
+ `${api} is not yet implemented. mochi is at v${VERSION} (claim release). ` +
17
+ `See https://github.com/0xchasercat/mochi.js for the implementation roadmap.`,
18
+ );
19
+ this.name = "NotImplementedError";
20
+ }
21
+ }
22
+
23
+ /**
24
+ * The mochi namespace. v0.0.1 placeholder; real surface lands in phase 0.1.
25
+ */
26
+ export const mochi = {
27
+ /** Framework version. */
28
+ version: VERSION,
29
+
30
+ /**
31
+ * Launch a browser session. Lands in phase 0.1.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * import { mochi } from "@mochi.js/core";
36
+ * const session = await mochi.launch({ profile: "mac-m2-chrome-stable", seed: "user-1" });
37
+ * ```
38
+ */
39
+ launch(_opts?: unknown): never {
40
+ throw new NotImplementedError("mochi.launch");
41
+ },
42
+ } as const;
43
+
44
+ export type Mochi = typeof mochi;