crumbtrail-tauri 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Crumbtrail
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # crumbtrail-tauri
2
+
3
+ Tauri v2 plugin for Crumbtrail. Replaces the HTTP transport with native IPC — no separate server process needed.
4
+
5
+ ## Setup
6
+
7
+ ### 1. Rust side
8
+
9
+ Add the plugin to your `src-tauri/Cargo.toml`:
10
+
11
+ ```toml
12
+ [dependencies]
13
+ tauri-plugin-crumbtrail = { path = "../packages/tauri/rust" }
14
+ ```
15
+
16
+ Register it in `src-tauri/src/lib.rs` (the Tauri v2 CLI scaffold's `run()`
17
+ entry point — `src-tauri/src/main.rs` just calls that `run()` and does not
18
+ build the `tauri::Builder` itself, so the plugin is registered here, not in
19
+ `main.rs`):
20
+
21
+ ```rust
22
+ #[cfg_attr(mobile, tauri::mobile_entry_point)]
23
+ pub fn run() {
24
+ tauri::Builder::default()
25
+ .plugin(tauri_plugin_crumbtrail::init())
26
+ .run(tauri::generate_context!())
27
+ .expect("error while running tauri application");
28
+ }
29
+ ```
30
+
31
+ ### 2. Permissions
32
+
33
+ Add to `src-tauri/capabilities/default.json`:
34
+
35
+ ```json
36
+ {
37
+ "permissions": ["crumbtrail:default"]
38
+ }
39
+ ```
40
+
41
+ ### 3. JavaScript side
42
+
43
+ ```bash
44
+ pnpm add crumbtrail-core crumbtrail-tauri
45
+ ```
46
+
47
+ ```typescript
48
+ import { Crumbtrail } from "crumbtrail-core";
49
+ import { TauriTransport } from "crumbtrail-tauri";
50
+
51
+ const logger = Crumbtrail.init({
52
+ transportInstance: new TauriTransport(),
53
+ });
54
+
55
+ // Use as normal
56
+ logger.mark("app-ready");
57
+
58
+ // When done
59
+ await logger.stop();
60
+ ```
61
+
62
+ ## How it works
63
+
64
+ The `TauriTransport` class implements `CrumbtrailTransport` using Tauri's `invoke()` IPC instead of HTTP `fetch()`. Events flow directly to the Rust backend which handles:
65
+
66
+ - **Session management** — creates session directories, writes `meta.json`
67
+ - **NDJSON writing** — appends events to `events.ndjson`
68
+ - **Blob storage** — writes binary files (screenshots, video chunks)
69
+ - **Post-processing** — generates `index.json` with error/request/navigation summaries
70
+
71
+ ## Session storage
72
+
73
+ Sessions are stored at:
74
+
75
+ ```
76
+ <app_data_dir>/crumbtrail-sessions/<session_id>/
77
+ ├── meta.json
78
+ ├── events.ndjson
79
+ ├── index.json
80
+ ├── frames/
81
+ └── (blobs)
82
+ ```
83
+
84
+ On macOS: `~/Library/Application Support/<bundle-id>/crumbtrail-sessions/`
85
+
86
+ ## MCP compatibility
87
+
88
+ The MCP server from `crumbtrail-node` reads session directories directly. Point it at the same output path to use MCP tools with Tauri-captured sessions:
89
+
90
+ ```bash
91
+ crumbtrail-server --output ~/Library/Application\ Support/<bundle-id>/crumbtrail-sessions
92
+ ```
93
+
94
+ ## Requirements
95
+
96
+ - Tauri v2
97
+ - Rust toolchain (rustup)
package/dist/index.cjs ADDED
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ TauriTransport: () => TauriTransport
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/transport.ts
28
+ var import_core = require("@tauri-apps/api/core");
29
+ var TauriTransport = class {
30
+ sessionId = "";
31
+ async startSession(sessionId, metadata) {
32
+ this.sessionId = sessionId;
33
+ await (0, import_core.invoke)("plugin:crumbtrail|start_session", { sessionId, metadata });
34
+ }
35
+ async endSession(sessionId) {
36
+ await (0, import_core.invoke)("plugin:crumbtrail|end_session", { sessionId });
37
+ }
38
+ async sendEvents(events) {
39
+ await (0, import_core.invoke)("plugin:crumbtrail|append_events", {
40
+ sessionId: this.sessionId,
41
+ events
42
+ });
43
+ }
44
+ async sendBlob(name, blob, metadata) {
45
+ const buffer = await blob.arrayBuffer();
46
+ await (0, import_core.invoke)("plugin:crumbtrail|write_blob", {
47
+ sessionId: this.sessionId,
48
+ name,
49
+ data: Array.from(new Uint8Array(buffer)),
50
+ metadata: metadata ?? {}
51
+ });
52
+ }
53
+ async sendBugReport(report, events, voiceBlob) {
54
+ await (0, import_core.invoke)("plugin:crumbtrail|flag_bug", {
55
+ report,
56
+ events
57
+ });
58
+ if (voiceBlob) {
59
+ const buffer = await voiceBlob.arrayBuffer();
60
+ await (0, import_core.invoke)("plugin:crumbtrail|write_bug_voice", {
61
+ bugId: report.bugId,
62
+ data: Array.from(new Uint8Array(buffer))
63
+ });
64
+ }
65
+ }
66
+ };
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ TauriTransport
70
+ });
@@ -0,0 +1,12 @@
1
+ import { CrumbtrailTransport, BugEvent, BugReport } from 'crumbtrail-core';
2
+
3
+ declare class TauriTransport implements CrumbtrailTransport {
4
+ private sessionId;
5
+ startSession(sessionId: string, metadata: Record<string, unknown>): Promise<void>;
6
+ endSession(sessionId: string): Promise<void>;
7
+ sendEvents(events: BugEvent[]): Promise<void>;
8
+ sendBlob(name: string, blob: Blob, metadata?: Record<string, unknown>): Promise<void>;
9
+ sendBugReport(report: BugReport, events: BugEvent[], voiceBlob?: Blob): Promise<void>;
10
+ }
11
+
12
+ export { TauriTransport };
@@ -0,0 +1,12 @@
1
+ import { CrumbtrailTransport, BugEvent, BugReport } from 'crumbtrail-core';
2
+
3
+ declare class TauriTransport implements CrumbtrailTransport {
4
+ private sessionId;
5
+ startSession(sessionId: string, metadata: Record<string, unknown>): Promise<void>;
6
+ endSession(sessionId: string): Promise<void>;
7
+ sendEvents(events: BugEvent[]): Promise<void>;
8
+ sendBlob(name: string, blob: Blob, metadata?: Record<string, unknown>): Promise<void>;
9
+ sendBugReport(report: BugReport, events: BugEvent[], voiceBlob?: Blob): Promise<void>;
10
+ }
11
+
12
+ export { TauriTransport };
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ // src/transport.ts
2
+ import { invoke } from "@tauri-apps/api/core";
3
+ var TauriTransport = class {
4
+ sessionId = "";
5
+ async startSession(sessionId, metadata) {
6
+ this.sessionId = sessionId;
7
+ await invoke("plugin:crumbtrail|start_session", { sessionId, metadata });
8
+ }
9
+ async endSession(sessionId) {
10
+ await invoke("plugin:crumbtrail|end_session", { sessionId });
11
+ }
12
+ async sendEvents(events) {
13
+ await invoke("plugin:crumbtrail|append_events", {
14
+ sessionId: this.sessionId,
15
+ events
16
+ });
17
+ }
18
+ async sendBlob(name, blob, metadata) {
19
+ const buffer = await blob.arrayBuffer();
20
+ await invoke("plugin:crumbtrail|write_blob", {
21
+ sessionId: this.sessionId,
22
+ name,
23
+ data: Array.from(new Uint8Array(buffer)),
24
+ metadata: metadata ?? {}
25
+ });
26
+ }
27
+ async sendBugReport(report, events, voiceBlob) {
28
+ await invoke("plugin:crumbtrail|flag_bug", {
29
+ report,
30
+ events
31
+ });
32
+ if (voiceBlob) {
33
+ const buffer = await voiceBlob.arrayBuffer();
34
+ await invoke("plugin:crumbtrail|write_bug_voice", {
35
+ bugId: report.bugId,
36
+ data: Array.from(new Uint8Array(buffer))
37
+ });
38
+ }
39
+ }
40
+ };
41
+ export {
42
+ TauriTransport
43
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "crumbtrail-tauri",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "dependencies": {
20
+ "@tauri-apps/api": "^2.0.0"
21
+ },
22
+ "peerDependencies": {
23
+ "crumbtrail-core": "^0.2.0"
24
+ },
25
+ "devDependencies": {
26
+ "typescript": "^5.8.3",
27
+ "tsup": "^8.5.0",
28
+ "vitest": "^3.2.0",
29
+ "crumbtrail-core": "^0.2.0"
30
+ },
31
+ "license": "MIT",
32
+ "homepage": "https://github.com/crumbtrail-dev/crumbtrail-js/tree/main/packages/tauri#readme",
33
+ "bugs": {
34
+ "url": "https://github.com/crumbtrail-dev/crumbtrail-js/issues"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/crumbtrail-dev/crumbtrail-js.git",
39
+ "directory": "packages/tauri"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "test": "vitest run",
47
+ "test:coverage": "vitest run --coverage",
48
+ "test:watch": "vitest",
49
+ "typecheck": "tsc --noEmit -p tsconfig.json",
50
+ "clean": "rm -rf dist"
51
+ }
52
+ }