sessiongraph 1.0.15 → 1.0.17

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 (41) hide show
  1. package/PRIVACY.md +15 -61
  2. package/README.md +36 -56
  3. package/bin/sessiongraph.mjs +14 -8
  4. package/dist/assets/{index-Kotmn42s.js → index-BcuycrLl.js} +1 -1
  5. package/dist/assets/{index-BLM-0yG6.js → index-CxNvtrVy.js} +1 -1
  6. package/dist/assets/{index-D4P4hbvc.js → index-DHztibvv.js} +1 -1
  7. package/dist/assets/index-Dm6VCxBu.js +186 -0
  8. package/dist/assets/index-ZvQzUBK1.css +1 -0
  9. package/dist/assets/katagami-sans-DMv8PCo8.woff2 +0 -0
  10. package/dist/assets/licenses/hugeicons.txt +21 -0
  11. package/dist/assets/licenses/katagami.txt +93 -0
  12. package/dist/assets/public-viewer-B3t-LR4T.js +24 -0
  13. package/dist/assets/public-viewer-CyDoUT6s.css +1 -0
  14. package/dist/assets/scene-CnihjOu5.js +248 -0
  15. package/dist/assets/share-BWJVjZdG.js +7 -0
  16. package/dist/assets/{three-D_1Qt16u.js → three-DDiuFd7k.js} +21 -21
  17. package/dist/assets/{worker-C10U_apJ.js → worker-B9mWJfQ6.js} +1 -1
  18. package/dist/index.html +2 -2
  19. package/dist-server/cli.mjs +48514 -15784
  20. package/dist-server/install-cli.mjs +204 -0
  21. package/dist-server/server.mjs +1196 -424
  22. package/docs/cli.md +293 -190
  23. package/docs/guide.md +15 -8
  24. package/docs/import-coverage.md +73 -5
  25. package/docs/performance.md +164 -0
  26. package/docs/releases.md +6 -0
  27. package/package.json +18 -10
  28. package/dist/assets/external-links-BmBkCsrt.js +0 -1
  29. package/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  30. package/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  31. package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  32. package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  33. package/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  34. package/dist/assets/index-B1kyvo41.js +0 -175
  35. package/dist/assets/index-Du0_nVjH.css +0 -1
  36. package/dist/assets/publishing-CEvQPkO1.css +0 -1
  37. package/dist/assets/publishing-D9CqkbeB.js +0 -23
  38. package/dist/assets/scene-CTHyYtma.js +0 -139
  39. package/dist/assets/share-Cw1E-ED9.js +0 -7
  40. package/docs/importer-comparison.md +0 -48
  41. package/docs/session-artifacts-audit.md +0 -176
package/PRIVACY.md CHANGED
@@ -1,72 +1,26 @@
1
1
  # Privacy and local data
2
2
 
3
- **Your session content stays on your computer while you import, search, and explore it in SessionGraph.** No SessionGraph account is required for these actions. SessionGraph has no automatic cloud sync and sends no analytics or crash reports. Optional public profiles upload only a snapshot you explicitly preview and confirm.
3
+ **Your session history stays on your device.** Import, search, and visualization run locally, without an account, automatic cloud sync, or app telemetry. Imports read selected sources without modifying them or starting an agent. The [privacy policy](https://sessiongraph.ai/privacy) covers the website and optional publishing.
4
4
 
5
- ## What happens locally
5
+ ## What a public graph shares
6
6
 
7
- - Imports read only the sources you select. Source histories are not modified, and importing does not start an agent, resume a conversation, or invoke a model.
8
- - Auto-import is enabled by default after source selection. It checks on startup, when returning to the app, and every minute while visible. Disable it in **Settings → Sources → Auto-import sessions**; this choice is saved in the local library and survives desktop restarts. Disabling it stops future automatic checks; an import already running can finish.
9
- - Parsing, indexing, search, and visualization run on your computer. Search does not use a remote embeddings or model service.
10
- - Imported conversations, metadata, timeline events, file-change evidence, and search checkpoints are saved in SessionGraph's local SQLite library.
11
- - View filters, time ranges, and appearance preferences are saved in the local SQLite library. Appearance preferences are also cached in browser/WebView local storage. Fonts and application assets are bundled.
12
- - Saved history remains available when a source is offline. Deselecting a source stops future imports; it does not delete previously imported history. Clearing the search index preserves imported history.
7
+ GitHub sign-in alone does not publish anything. SessionGraph builds the preview locally and uploads only the metadata snapshot for the sessions you select, after you confirm. Subsequent imports do not update it. You can inspect the exact JSON before sharing.
13
8
 
14
- ## Network access
9
+ - **Always included:** graph-specific numeric session IDs and groups, and recorded parent or fork links within the selection.
10
+ - **Optional:** token counts, session and message timestamps, message counts, recognized model names, and coding-tool names. Disabled fields are omitted.
11
+ - **Never included:** conversation text, code, tool inputs or outputs, project or session names, file paths, native session IDs, credentials, or costs.
15
12
 
16
- | Action | Connection | Session content sent externally by SessionGraph |
17
- | --- | --- | --- |
18
- | Browse, search, and visualize saved history | Authenticated backend on `127.0.0.1` | None |
19
- | Import OpenCode history | OpenCode's authenticated loopback API; OpenCode must be running locally | None |
20
- | Import Claude Code, Codex, Cursor, Gemini CLI, Qwen Code, Pi, GitHub Copilot CLI, Cline, Roo Code, Kilo Code, or Continue history | Local history reads within the [documented source coverage](docs/guide.md#source-coverage) | None |
21
- | Check for or download desktop updates | GitHub Releases and its download infrastructure | None |
22
- | Install or update through npm | npm registry and its download infrastructure | None |
23
- | Sign in or manage an account/organization | GitHub and `sessiongraph.ai` | None; GitHub identity and account actions only |
24
- | Preview a public graph | Local authenticated backend | None; preview is prepared locally |
25
- | Publish or update a public graph | `sessiongraph.ai` | Only the configured metadata snapshot shown in the confirmed preview |
26
- | View a public profile | `sessiongraph.ai` | Normal web request metadata; the selected snapshot is publicly readable |
27
- | Open an external link | Your browser opens the destination you choose | The destination's normal browser/privacy behavior applies |
28
- | Continue a session in another harness | An explicit launch opens the selected harness | The harness may send saved context to its model provider under its own settings |
13
+ Anyone can view a published graph at `/@<github_username>` or find it in **Explore graphs**. Anonymous session labels do not anonymize your profile; timestamps and activity can reveal work patterns. The site stores the latest confirmed snapshot. **Unpublish** in the app or on the [account page](https://sessiongraph.ai/account) removes the hosted copy, not copies others already saved. Signing out does not unpublish.
29
14
 
30
- The desktop app checks for updates automatically. GitHub and npm receive ordinary request metadata, such as your public IP address, when contacted. Update requests do not include your conversations, search terms, file paths, or session identifiers. SessionGraph therefore does not promise zero internet connections.
15
+ ## Local files and network access
31
16
 
32
- Preparing a cross-harness continuation may write a local Markdown handoff containing saved conversation context. Preparing or copying the command does not start an agent. Running it allows the destination harness to read that context; that harness's privacy policy and configuration apply.
17
+ The SQLite library stores imported sessions, search data, and preferences on your device. See the [storage guide](docs/guide.md#local-storage-and-privacy) for paths and overrides. Handoff files and optional desktop login credentials also stay on your device. SessionGraph does not encrypt these files; use OS permissions and disk encryption as needed.
33
18
 
34
- ## Optional public profiles
19
+ Desktop releases install the `sessiongraph` and `ssg` commands on first launch.
20
+ Setup copies CLI files to a per-user application-data directory and adds it to
21
+ your shell profiles or Windows user PATH, preserving existing entries.
22
+ See [CLI installation](docs/cli.md#install).
35
23
 
36
- Publishing requires GitHub sign-in and explicit confirmation in **Publish and account**. The preview covers the current filtered selection and uses the same graph renderer as the website. You can inspect the exact JSON before publishing. Importing, signing in, or changing publication settings does not upload history. Each update requires a fresh confirmed preview; published snapshots do not track subsequent imports.
24
+ Desktop updates contact GitHub, and npm installs contact the npm registry. Those requests do not include session history. The hosted service handles optional GitHub sign-in, publishing, and organization features. Organizations do not share your local history. If you explicitly continue a conversation in another coding tool, that tool may send the handoff context to its model provider under its own settings.
37
25
 
38
- - **Always excluded:** project/session names, conversation text, tool content, code, paths, native identifiers, and costs. Anonymous numeric groups and recorded parent/fork links within the selection remain visible.
39
- - **Configurable:** token counts, session timestamps, message counts, message timestamps, model, and harness. Disabled fields are omitted entirely. Message timestamps require session timestamps and message counts. Only recognized public model identifiers are retained; custom aliases are hidden.
40
- - **Limits:** 10,000 sessions, 2 MB of public JSON, at most 2,000 message timestamps per session and 100,000 overall, and a compressed stored snapshot under 1 MB. Message metadata covers user/assistant messages. Partial history, unknown values, and limited timestamp coverage are disclosed.
41
- - **Public identity:** the profile at `/@<github_username>` is attributable to that GitHub account. Anonymous session labels do not make the profile anonymous. Timing, activity, grouping, and usage may still reveal working patterns.
42
- - **Discovery:** published profiles appear in Explore graphs with an anonymous graph thumbnail, session count, and token total when shared and available. Thumbnails are generated from the validated public snapshot, never a screenshot of your local app. The public explorer uses the same renderer as the local app but reads only published metadata. It cannot access local imports, conversations, files, credentials, or harness launch actions.
43
- - **Removal:** unpublish from the desktop or website to remove the hosted graph. Signing out leaves it published. Copies already downloaded by other people are outside SessionGraph's control.
44
-
45
- The hosted service stores the GitHub numeric ID and current username, the latest published snapshot, organization names/slugs, memberships, invitations, and hashed login tokens. GitHub repository access is not requested; the temporary provider token is discarded after login. Browser sessions use secure HttpOnly cookies. Desktop sign-in requires browser approval and a one-time verifier exchange. Login sessions expire after 30 days, device approvals after two minutes, and invitations after seven days. Expired records are rejected immediately and removed by scheduled cleanup.
46
-
47
- Account and public-profile requests pass through Vercel; hosted records are stored in AWS. Providers receive ordinary connection metadata such as IP addresses. The application stores short-lived hashed request buckets for rate limiting. Organization membership does not share local sessions or publish a graph.
48
-
49
- ## Where data is stored
50
-
51
- New installations use:
52
-
53
- - **macOS:** `~/Library/Application Support/SessionGraph/sessiongraph.sqlite`
54
- - **Windows:** `%LOCALAPPDATA%/SessionGraph/sessiongraph.sqlite`
55
- - **Linux:** `$XDG_DATA_HOME/sessiongraph/sessiongraph.sqlite`, defaulting to `~/.local/share/sessiongraph/sessiongraph.sqlite`
56
-
57
- `SESSIONGRAPH_DATA_DIR` overrides the location. Existing libraries from earlier app versions can be reused in place; see [storage resolution](docs/guide.md#local-storage-and-privacy). SQLite may also create `-wal` and `-shm` companion files. Saved-context Markdown files live in the library directory's `handoffs/` folder.
58
-
59
- Optional desktop login credentials live in `account.json` beside the library. The backend writes this file with owner-only permissions where supported and never returns its bearer token to the UI. The file is not encrypted; protect it like other local credentials. Signing out revokes the token remotely and removes the file; if revocation fails, the app keeps it so you can retry. Publishing field preferences are saved in the local library.
60
-
61
- **SessionGraph does not encrypt its database, search text, or handoff files.** Local filesystem permissions protect access where supported. Your OS account, disk encryption, device security, and backup/sync configuration affect confidentiality. SessionGraph does not control backups or the original harnesses' storage and cloud services.
62
-
63
- Application bundles and npm packages contain application assets, not your imported library. The repository's demo images and video use synthetic sessions.
64
-
65
- ## How to verify the behavior
66
-
67
- - Inspect the [source adapters](server/adapters/), [local API](server/standalone.ts), [search worker](src/search/worker.ts), and [desktop updater](src/updater.ts).
68
- - After importing a library, disconnect from the internet and browse/search it. OpenCode imports additionally require its local service, but browsing saved history does not.
69
- - Use an OS-level network monitor or firewall to inspect both the native app and its bundled Node backend. Browser developer tools alone do not show native updater traffic. Distinguish update checks from actions that explicitly open another application.
70
- - Compare downloaded artifacts with the release's `SHA256SUMS`. The desktop updater verifies version-bound signatures before installation. These establish artifact integrity and authenticity; they are not a privacy audit.
71
-
72
- These statements describe SessionGraph's implemented behavior. They are not a claim of an independent security audit or protection against other software with access to your device.
26
+ To check local behavior, disconnect from the internet and browse or search an already imported library. You can also inspect the [source adapters](server/adapters/), [local API](server/standalone.ts), and [public graph format](packages/core/src/public-graph.ts).
package/README.md CHANGED
@@ -1,4 +1,7 @@
1
- <h1 align="center"><picture><source media="(prefers-color-scheme: light)" srcset="public/brand/lockup-light.svg"><img src="public/brand/lockup.svg" width="420" alt="SessionGraph"></picture></h1>
1
+ <h1 align="center">
2
+ <img src="public/brand/lockup.svg#gh-dark-mode-only" width="420" alt="SessionGraph">
3
+ <img src="public/brand/lockup-light.svg#gh-light-mode-only" width="420" alt="SessionGraph">
4
+ </h1>
2
5
  <p align="center">Explore &amp; visualize all your LLM sessions</p>
3
6
  <p align="center">
4
7
  <a href="https://github.com/arvindell/sessiongraph/releases/latest">Download</a> ·
@@ -7,27 +10,29 @@
7
10
  <a href="docs/releases.md">Releases</a>
8
11
  </p>
9
12
 
10
- [![SessionGraph in action: zoom, playback, messages, search, and twelve sources using synthetic sessions](docs/sessiongraph-demo.gif)](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-demo.mp4)
13
+ [![SessionGraph in action: orbit a branching graph, explore messages, play the timeline, and search synthetic sessions](docs/sessiongraph-demo.gif)](https://raw.githubusercontent.com/arvindell/sessiongraph/main/docs/sessiongraph-demo.mp4)
11
14
 
12
- [Watch the 60 FPS demo →](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-demo.mp4)
15
+ Explore local history from **OpenCode, Claude Code, Codex, T3 Code, Cursor, Gemini, Pi, and more** in one app. Search conversations, browse messages, and inspect changed files.
13
16
 
14
- Explore local history from **OpenCode, Claude Code, Codex, T3 Code, Cursor, Gemini, Pi, OpenClaw, Hermes, Kiro, Mux, and many more** in one app. [Source-by-source coverage →](docs/import-coverage.md)
15
- Search conversations, explore user and assistant messages, inspect changed files, and continue in another harness.
16
- Hover to preview messages, click to focus, and click empty space to deselect. Tune the glowing map, trails, and click sounds in Settings.
17
- During playback, session orbs travel through time, leaving trails behind them. Message dots match their session's color.
18
- Importing, searching, and visualization stay on your computer.
17
+ - **Session orbs** show your conversations over time.
18
+ - **Fork connections** show where sessions branched or spawned subagents.
19
+ - **Clusters** group sessions by project directory, even across harnesses.
19
20
 
20
21
  ### Your history stays local
21
22
 
22
- **No account. No cloud sync. No telemetry.** SessionGraph reads your selected local sources and keeps imported conversations and the search index on your computer. Importing and exploring history never starts an AI agent or sends your conversations to a model provider.
23
+ **No account needed.** SessionGraph reads your local history without changing it. Imported conversations and search stay on your computer.
23
24
 
24
- Desktop update checks and downloads contact GitHub without session content; npm installation contacts the npm registry. Explicitly continuing a session opens your chosen harness, which follows its own network and privacy settings. Saved history is not encrypted by SessionGraph; device access and backups affect its confidentiality.
25
+ ### Install
25
26
 
26
- [Read the privacy details, storage locations, and verification steps →](PRIVACY.md)
27
+ Run the desktop app with **Node.js 24+**:
27
28
 
28
- ### Install
29
+ ```sh
30
+ npx sessiongraph
31
+ ```
29
32
 
30
- Download the latest desktop app — no Node.js required:
33
+ Prefer your browser? Run `npx sessiongraph --browser`.
34
+
35
+ Or download an installer — no Node.js required:
31
36
 
32
37
  | Platform | Direct downloads |
33
38
  | --- | --- |
@@ -37,48 +42,26 @@ Download the latest desktop app — no Node.js required:
37
42
  | Linux · x64 | [AppImage](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-linux-x64.AppImage) · [DEB](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-linux-x64.deb) · [RPM](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-linux-x64.rpm) |
38
43
  | Linux · ARM64 | [AppImage](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-linux-arm64.AppImage) · [DEB](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-linux-arm64.deb) · [RPM](https://github.com/arvindell/sessiongraph/releases/latest/download/sessiongraph-linux-arm64.rpm) |
39
44
 
40
- Desktop updates appear as a small **Update** pill. Download and verify, then click **Restart** when you're ready.
41
-
42
- The npm launcher requires **Node.js 24+**:
43
-
44
- ```sh
45
- npx sessiongraph
46
- npx sessiongraph --browser
47
- ```
48
-
49
- - **`sessiongraph`** opens the native desktop app for your OS, with its own local backend and bundled runtime.
50
- - **`sessiongraph --browser`** starts an authenticated localhost server and opens the same explorer in your default browser. Keep the terminal running; **Ctrl+C** stops it.
51
- - Both use the same saved local library. Import once, explore in either mode.
52
-
53
45
  ### Harness support
54
46
 
55
- | Harness | Import from | Continue sessions |
56
- | --- | --- | --- |
57
- | <img src="public/sources/opencode.svg" width="14" alt=""/> **OpenCode** | Authenticated local API; run OpenCode when importing | Native resume / saved-context handoff |
58
- | <img src="public/sources/claude.svg" width="14" alt=""/> **Claude Code** | Local projects, worktrees, and subagents via SDK | Native resume / saved-context handoff |
59
- | <img src="public/sources/openai.svg" width="14" alt=""/> **Codex** | Active and archived local rollouts | Native resume / saved-context handoff |
60
- | <img src="public/sources/t3.svg" width="14" alt=""/> **T3 Code** | Local server SQLite threads and activity | Saved-context handoff to a supported CLI |
61
- | <img src="public/sources/cursor.svg" width="14" alt=""/> **Cursor** | IDE transcripts, legacy Composer, CLI and ACP stores | CLI resume where supported / saved-context handoff |
62
- | <img src="public/sources/gemini.svg" width="14" alt=""/> **Gemini CLI** | Local JSON and append-only JSONL chats | Native resume / saved-context handoff |
63
- | <img src="public/sources/qwen.svg" width="14" alt=""/> **Qwen Code** | Local project chat records | Native resume / saved-context handoff |
64
- | <img src="public/sources/pi.svg" width="14" alt=""/> **Pi** | Local JSONL session trees | Native resume / saved-context handoff |
65
- | <img src="public/sources/copilot.svg" width="14" alt=""/> **GitHub Copilot CLI** | Local persisted session events | Native resume / saved-context handoff |
66
- | <img src="public/sources/copilot.svg" width="14" alt=""/> **GitHub Copilot Chat (VS Code)** | VS Code / Insiders saved Chat UI history on Windows, macOS, and Linux | Saved-context handoff to a supported CLI |
67
- | <img src="public/sources/cline.svg" width="14" alt=""/> **Cline** | Extension tasks and CLI/SDK message snapshots | Saved-context handoff to a supported CLI |
68
- | <img src="public/sources/roo.svg" width="14" alt=""/> **Roo Code** | Local extension task histories | Saved-context handoff to a supported CLI |
69
- | <img src="public/sources/kilo.svg" width="14" alt=""/> **Kilo Code / CLI** | Extension task JSON; separate Kilo CLI SQLite source | Saved-context handoff to a supported CLI |
70
- | <img src="public/sources/continue.svg" width="14" alt=""/> **Continue** | Local IDE and CLI session JSON | Saved-context handoff to a supported CLI |
71
-
72
- Import is read-only. Saved sessions remain available when a harness is offline. [Coverage and limitations →](docs/guide.md#source-coverage)
73
-
74
- Additional sources include OpenClaw, Prime Agent, Oh My Pi, Senpi, Kimchi, Gajae, Hermes, Amp, Droid, Codebuff/Freebuff, Kimi, Grok, Jcode, Cherry Studio, Command Code, ZCode, CodeBuddy, WorkBuddy, Proma, DeepSeek Harness, Aside, Vibe, Goose, Zed, Devin CLI/Desktop, Crush, Octofriend, MiMo Code/Desktop, Unsloth, and Kiro/Mux. Junie, Muse, Augment, and OpenCodeReview have partial event coverage. Fx and Antigravity expose session metadata and dates only. Sources that cannot provide session identities and dates are excluded. See the [format matrix](docs/import-coverage.md) for paths and remaining gaps.
75
-
76
- Choose harnesses in **Settings → Sources** or **Manage sources** next to the source filter. **Auto-import is on by default**: SessionGraph checks for new and changed sessions on startup, when you return, and every minute while visible. Turn it off in **Settings → Sources → Auto-import sessions**. **Refresh sessions** also works manually.
77
-
78
- Your time range, source/project/directory filters, archived and child-session toggles, and appearance preferences are saved with the local library and restored after restarting.
79
- The default range is **All time**, with archived sessions hidden. Enable them in **Settings → Interface → Show archived sessions**.
80
-
81
- Manual and automatic refresh preserve your map position, zoom, and selection. New history keeps existing layout positions stable; use **Fit view (F)** to reframe the whole map.
47
+ | Harness | Local history |
48
+ | --- | --- |
49
+ | <img src="public/sources/opencode.svg" width="14" alt=""/> **OpenCode** | Run OpenCode when importing |
50
+ | <img src="public/sources/claude.svg" width="14" alt=""/> **Claude Code** | Projects, worktrees, and subagents |
51
+ | <img src="public/sources/openai.svg" width="14" alt=""/> **Codex** | Active and archived sessions |
52
+ | <img src="public/sources/t3.svg" width="14" alt=""/> **T3 Code** | Threads and activity |
53
+ | <img src="public/sources/cursor.svg" width="14" alt=""/> **Cursor** | IDE and CLI conversations |
54
+ | <img src="public/sources/gemini.svg" width="14" alt=""/> **Gemini CLI** | Saved chats |
55
+ | <img src="public/sources/qwen.svg" width="14" alt=""/> **Qwen Code** | Project chats |
56
+ | <img src="public/sources/pi.svg" width="14" alt=""/> **Pi** | Session trees |
57
+ | <img src="public/sources/copilot.svg" width="14" alt=""/> **GitHub Copilot CLI** | Saved sessions |
58
+ | <img src="public/sources/copilot.svg" width="14" alt=""/> **GitHub Copilot Chat (VS Code)** | Saved IDE chats |
59
+ | <img src="public/sources/cline.svg" width="14" alt=""/> **Cline** | Tasks and messages |
60
+ | <img src="public/sources/roo.svg" width="14" alt=""/> **Roo Code** | Task history |
61
+ | <img src="public/sources/kilo.svg" width="14" alt=""/> **Kilo Code / CLI** | Extension and CLI sessions |
62
+ | <img src="public/sources/continue.svg" width="14" alt=""/> **Continue** | IDE and CLI sessions |
63
+
64
+ Also supports OpenClaw, Hermes, Kiro, Mux, and more. [Full source list and coverage →](docs/import-coverage.md)
82
65
 
83
66
  ### Develop
84
67
 
@@ -88,9 +71,6 @@ portless sessiongraph pnpm dev
88
71
  ```
89
72
 
90
73
  `pnpm desktop:dev` runs the native app. `pnpm test` runs the tests.
91
- See the [guide](docs/guide.md) for source coverage, shortcuts, storage, and building locally.
92
-
93
- Shared graph code and the website are organized as pnpm workspace packages in [`packages/`](packages/README.md). The website lives in [`packages/site/`](packages/site/README.md) and serves [sessiongraph.ai](https://sessiongraph.ai).
94
74
 
95
75
  ### License
96
76
 
@@ -30,14 +30,20 @@ function open(target) {
30
30
  child.on('error', () => console.error('Could not open the application. Check your desktop environment.')); child.unref();
31
31
  }
32
32
  if (!argv.includes('--browser')) {
33
- const name = `${pkg.name}-app-${process.platform}-${process.arch}`;
34
- try {
35
- const manifest = require.resolve(`${name}/package.json`);
36
- const app = join(dirname(manifest), 'payload', process.platform === 'darwin' ? 'SessionGraph.app' : process.platform === 'win32' ? 'SessionGraph.exe' : 'SessionGraph.AppImage');
37
- if (process.platform === 'darwin') open(app);
38
- else { const child = spawn(app, [], { detached: true, stdio: 'ignore', env: { ...process.env, ...(process.platform === 'linux' ? { APPIMAGE_EXTRACT_AND_RUN: '1' } : {}) } }); child.on('error', (e) => console.error(`SessionGraph could not open: ${e.message}`)); child.unref(); }
39
- } catch {
40
- console.error(`Desktop package ${name} is not installed.\nUse npx ${pkg.name} --browser, or install the matching desktop package.\nFor a source checkout: pnpm desktop:dev`); process.exitCode = 1;
33
+ if (pkg.sessionGraphDesktopExecutable) {
34
+ const child = spawn(pkg.sessionGraphDesktopExecutable, [], { detached: true, stdio: 'ignore', env: { ...process.env, ...(process.platform === 'linux' ? { APPIMAGE_EXTRACT_AND_RUN: '1' } : {}) } });
35
+ child.on('error', (error) => { console.error(`SessionGraph could not open: ${error.message}`); process.exitCode = 1; });
36
+ child.unref();
37
+ } else {
38
+ const name = `${pkg.name}-app-${process.platform}-${process.arch}`;
39
+ try {
40
+ const manifest = require.resolve(`${name}/package.json`);
41
+ const app = join(dirname(manifest), 'payload', process.platform === 'darwin' ? 'SessionGraph.app' : process.platform === 'win32' ? 'SessionGraph.exe' : 'SessionGraph.AppImage');
42
+ if (process.platform === 'darwin') open(app);
43
+ else { const child = spawn(app, [], { detached: true, stdio: 'ignore', env: { ...process.env, ...(process.platform === 'linux' ? { APPIMAGE_EXTRACT_AND_RUN: '1' } : {}) } }); child.on('error', (e) => console.error(`SessionGraph could not open: ${e.message}`)); child.unref(); }
44
+ } catch {
45
+ console.error(`Desktop package ${name} is not installed.\nUse npx ${pkg.name} --browser, or install the matching desktop package.\nFor a source checkout: pnpm desktop:dev`); process.exitCode = 1;
46
+ }
41
47
  }
42
48
  } else {
43
49
  const child = spawn(process.execPath, [join(root, 'dist-server', 'server.mjs'), '--assets', join(root, 'dist'), '--parent-pid', String(process.pid)], { stdio: ['ignore', 'pipe', 'inherit'] });
@@ -1 +1 @@
1
- import{E as i}from"./index-B1kyvo41.js";function r(e){if(e!==void 0){if(typeof e=="string")return e;if("ok"in e&&"cancel"in e)return{OkCancelCustom:[e.ok,e.cancel]};if("yes"in e&&"no"in e&&"cancel"in e)return{YesNoCancelCustom:[e.yes,e.no,e.cancel]};if("ok"in e)return{OkCustom:e.ok}}}async function f(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|open",{options:e})}async function k(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|save",{options:e})}async function l(e,a){return await i("plugin:dialog|message",{message:e,title:a?.title,kind:a?.kind,buttons:r(a?.buttons)})}async function s(e,a){const n=typeof a=="string"?{title:a}:a;return n&&!n.buttons&&n.okLabel&&(n.buttons={ok:n.okLabel}),l(e,n)}async function u(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Yes";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"No"}:"YesNo"})===t}async function d(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Ok";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"Cancel"}:"OkCancel"})===t}export{u as ask,d as confirm,s as message,f as open,k as save};
1
+ import{j as i}from"./index-Dm6VCxBu.js";function r(e){if(e!==void 0){if(typeof e=="string")return e;if("ok"in e&&"cancel"in e)return{OkCancelCustom:[e.ok,e.cancel]};if("yes"in e&&"no"in e&&"cancel"in e)return{YesNoCancelCustom:[e.yes,e.no,e.cancel]};if("ok"in e)return{OkCustom:e.ok}}}async function f(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|open",{options:e})}async function k(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|save",{options:e})}async function l(e,a){return await i("plugin:dialog|message",{message:e,title:a?.title,kind:a?.kind,buttons:r(a?.buttons)})}async function s(e,a){const n=typeof a=="string"?{title:a}:a;return n&&!n.buttons&&n.okLabel&&(n.buttons={ok:n.okLabel}),l(e,n)}async function u(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Yes";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"No"}:"YesNo"})===t}async function d(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Ok";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"Cancel"}:"OkCancel"})===t}export{u as ask,d as confirm,s as message,f as open,k as save};
@@ -1 +1 @@
1
- import{E as a,U as i,V as o}from"./index-B1kyvo41.js";class l extends i{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,n){const d=new o;e&&(d.onmessage=e);const r=await a("plugin:updater|download",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)});await this.downloadedBytes?.close().catch(()=>{}),this.downloadedBytes=new i(r)}async install(e){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await a("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid,...e}),this.downloadedBytes=void 0}async downloadAndInstall(e,n){const d=new o;e&&(d.onmessage=e),await a("plugin:updater|download_and_install",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)})}async close(){await this.downloadedBytes?.close(),await super.close()}}async function w(s){const e=await a("plugin:updater|check",{...s,headers:t(s?.headers)});return e?new l(e):null}function t(s){return s?Array.from(new Headers(s).entries()):void 0}export{l as Update,w as check};
1
+ import{j as a,R as i,C as o}from"./index-Dm6VCxBu.js";class l extends i{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,n){const d=new o;e&&(d.onmessage=e);const r=await a("plugin:updater|download",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)});await this.downloadedBytes?.close().catch(()=>{}),this.downloadedBytes=new i(r)}async install(e){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await a("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid,...e}),this.downloadedBytes=void 0}async downloadAndInstall(e,n){const d=new o;e&&(d.onmessage=e),await a("plugin:updater|download_and_install",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)})}async close(){await this.downloadedBytes?.close(),await super.close()}}async function w(s){const e=await a("plugin:updater|check",{...s,headers:t(s?.headers)});return e?new l(e):null}function t(s){return s?Array.from(new Headers(s).entries()):void 0}export{l as Update,w as check};
@@ -1 +1 @@
1
- import{U as a,E as i,V as R}from"./index-B1kyvo41.js";var w;(function(n){n[n.Audio=1]="Audio",n[n.Cache=2]="Cache",n[n.Config=3]="Config",n[n.Data=4]="Data",n[n.LocalData=5]="LocalData",n[n.Document=6]="Document",n[n.Download=7]="Download",n[n.Picture=8]="Picture",n[n.Public=9]="Public",n[n.Video=10]="Video",n[n.Resource=11]="Resource",n[n.Temp=12]="Temp",n[n.AppConfig=13]="AppConfig",n[n.AppData=14]="AppData",n[n.AppLocalData=15]="AppLocalData",n[n.AppCache=16]="AppCache",n[n.AppLog=17]="AppLog",n[n.Desktop=18]="Desktop",n[n.Executable=19]="Executable",n[n.Font=20]="Font",n[n.Home=21]="Home",n[n.Runtime=22]="Runtime",n[n.Template=23]="Template"})(w||(w={}));var d;(function(n){n[n.Start=0]="Start",n[n.Current=1]="Current",n[n.End=2]="End"})(d||(d={}));function u(n){return{isFile:n.isFile,isDirectory:n.isDirectory,isSymlink:n.isSymlink,size:n.size,mtime:n.mtime!==null?new Date(n.mtime):null,atime:n.atime!==null?new Date(n.atime):null,birthtime:n.birthtime!==null?new Date(n.birthtime):null,readonly:n.readonly,fileAttributes:n.fileAttributes,dev:n.dev,ino:n.ino,mode:n.mode,nlink:n.nlink,uid:n.uid,gid:n.gid,rdev:n.rdev,blksize:n.blksize,blocks:n.blocks}}function U(n){const e=new Uint8ClampedArray(n),t=e.byteLength;let o=0;for(let r=0;r<t;r++){const s=e[r];o*=256,o+=s}return o}class g extends a{async read(e){if(e.byteLength===0)return 0;const t=await i("plugin:fs|read",{rid:this.rid,len:e.byteLength}),o=U(t.slice(-8)),r=t instanceof ArrayBuffer?new Uint8Array(t):t;return e.set(r.slice(0,r.length-8)),o===0?null:o}async seek(e,t){return await i("plugin:fs|seek",{rid:this.rid,offset:e,whence:t})}async stat(){const e=await i("plugin:fs|fstat",{rid:this.rid});return u(e)}async truncate(e){await i("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await i("plugin:fs|write",{rid:this.rid,data:e})}}async function b(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|create",{path:n instanceof URL?n.toString():n,options:e});return new g(t)}async function p(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|open",{path:n instanceof URL?n.toString():n,options:e});return new g(t)}async function S(n,e,t){if(n instanceof URL&&n.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|copy_file",{fromPath:n instanceof URL?n.toString():n,toPath:e instanceof URL?e.toString():e,options:t})}async function A(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|mkdir",{path:n instanceof URL?n.toString():n,options:e})}async function T(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|read_dir",{path:n instanceof URL?n.toString():n,options:e})}async function E(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|read_file",{path:n instanceof URL?n.toString():n,options:e});return t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}async function _(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|read_text_file",{path:n instanceof URL?n.toString():n,options:e}),o=t instanceof ArrayBuffer?t:Uint8Array.from(t);return new TextDecoder(e?.encoding??"utf-8").decode(o)}async function x(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=n instanceof URL?n.toString():n;return await Promise.resolve({path:t,rid:null,async next(){const o=new TextDecoder(e?.encoding??"utf-8");if(this.rid===null){const l=o.encoding;this.rid=await i("plugin:fs|read_text_file_lines",{path:t,options:e!=null?{...e,encoding:l}:void 0})}let r;try{r=await i("plugin:fs|read_text_file_lines_next",{rid:this.rid})}catch(l){throw this.rid=null,l}const s=r instanceof ArrayBuffer?new Uint8Array(r):Uint8Array.from(r),f=s[s.byteLength-1]===1;return f?(this.rid=null,{value:null,done:f}):{value:o.decode(s.slice(0,s.byteLength-1)),done:f}},async return(){if(this.rid!==null){const o=this.rid;this.rid=null,await new a(o).close()}return{value:null,done:!0}},[Symbol.asyncIterator](){return this}})}async function v(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|remove",{path:n instanceof URL?n.toString():n,options:e})}async function M(n,e,t){if(n instanceof URL&&n.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|rename",{oldPath:n instanceof URL?n.toString():n,newPath:e instanceof URL?e.toString():e,options:t})}async function C(n,e){const t=await i("plugin:fs|stat",{path:n instanceof URL?n.toString():n,options:e});return u(t)}async function k(n,e){const t=await i("plugin:fs|lstat",{path:n instanceof URL?n.toString():n,options:e});return u(t)}async function F(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|truncate",{path:n instanceof URL?n.toString():n,len:e,options:t})}async function z(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");if(e instanceof ReadableStream){const o=await p(n,{read:!1,create:!0,write:!0,...t,truncate:!t?.append}),r=e.getReader();try{for(;;){const{done:s,value:f}=await r.read();if(s)break;await o.write(f)}}finally{r.releaseLock(),await o.close()}}else await i("plugin:fs|write_file",e,{headers:{path:encodeURIComponent(n instanceof URL?n.toString():n),options:JSON.stringify(t)}})}async function I(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const o=new TextEncoder;await i("plugin:fs|write_text_file",o.encode(e),{headers:{path:encodeURIComponent(n instanceof URL?n.toString():n),options:JSON.stringify(t)}})}async function H(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|exists",{path:n instanceof URL?n.toString():n,options:e})}class y extends a{}async function L(n,e,t){const o=Array.isArray(n)?n:[n];for(const c of o)if(c instanceof URL&&c.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=new R;r.onmessage=e;const s=await i("plugin:fs|watch",{paths:o.map(c=>c instanceof URL?c.toString():c),options:t,onEvent:r}),f=new y(s);return()=>{f.close()}}async function V(n,e,t){return await L(n,e,{delayMs:2e3,...t})}async function J(n,e,t){return await L(n,e,{...t,delayMs:void 0})}async function N(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|size",{path:n instanceof URL?n.toString():n,options:e})}async function O(n){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|start_accessing_security_scoped_resource",{path:n instanceof URL?n.toString():n})}async function h(n){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|stop_accessing_security_scoped_resource",{path:n instanceof URL?n.toString():n})}export{w as BaseDirectory,g as FileHandle,d as SeekMode,S as copyFile,b as create,H as exists,k as lstat,A as mkdir,p as open,T as readDir,E as readFile,_ as readTextFile,x as readTextFileLines,v as remove,M as rename,N as size,O as startAccessingSecurityScopedResource,C as stat,h as stopAccessingSecurityScopedResource,F as truncate,V as watch,J as watchImmediate,z as writeFile,I as writeTextFile};
1
+ import{R as a,j as i,C as R}from"./index-Dm6VCxBu.js";var w;(function(n){n[n.Audio=1]="Audio",n[n.Cache=2]="Cache",n[n.Config=3]="Config",n[n.Data=4]="Data",n[n.LocalData=5]="LocalData",n[n.Document=6]="Document",n[n.Download=7]="Download",n[n.Picture=8]="Picture",n[n.Public=9]="Public",n[n.Video=10]="Video",n[n.Resource=11]="Resource",n[n.Temp=12]="Temp",n[n.AppConfig=13]="AppConfig",n[n.AppData=14]="AppData",n[n.AppLocalData=15]="AppLocalData",n[n.AppCache=16]="AppCache",n[n.AppLog=17]="AppLog",n[n.Desktop=18]="Desktop",n[n.Executable=19]="Executable",n[n.Font=20]="Font",n[n.Home=21]="Home",n[n.Runtime=22]="Runtime",n[n.Template=23]="Template"})(w||(w={}));var d;(function(n){n[n.Start=0]="Start",n[n.Current=1]="Current",n[n.End=2]="End"})(d||(d={}));function u(n){return{isFile:n.isFile,isDirectory:n.isDirectory,isSymlink:n.isSymlink,size:n.size,mtime:n.mtime!==null?new Date(n.mtime):null,atime:n.atime!==null?new Date(n.atime):null,birthtime:n.birthtime!==null?new Date(n.birthtime):null,readonly:n.readonly,fileAttributes:n.fileAttributes,dev:n.dev,ino:n.ino,mode:n.mode,nlink:n.nlink,uid:n.uid,gid:n.gid,rdev:n.rdev,blksize:n.blksize,blocks:n.blocks}}function U(n){const e=new Uint8ClampedArray(n),t=e.byteLength;let o=0;for(let r=0;r<t;r++){const s=e[r];o*=256,o+=s}return o}class g extends a{async read(e){if(e.byteLength===0)return 0;const t=await i("plugin:fs|read",{rid:this.rid,len:e.byteLength}),o=U(t.slice(-8)),r=t instanceof ArrayBuffer?new Uint8Array(t):t;return e.set(r.slice(0,r.length-8)),o===0?null:o}async seek(e,t){return await i("plugin:fs|seek",{rid:this.rid,offset:e,whence:t})}async stat(){const e=await i("plugin:fs|fstat",{rid:this.rid});return u(e)}async truncate(e){await i("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await i("plugin:fs|write",{rid:this.rid,data:e})}}async function b(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|create",{path:n instanceof URL?n.toString():n,options:e});return new g(t)}async function p(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|open",{path:n instanceof URL?n.toString():n,options:e});return new g(t)}async function S(n,e,t){if(n instanceof URL&&n.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|copy_file",{fromPath:n instanceof URL?n.toString():n,toPath:e instanceof URL?e.toString():e,options:t})}async function A(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|mkdir",{path:n instanceof URL?n.toString():n,options:e})}async function T(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|read_dir",{path:n instanceof URL?n.toString():n,options:e})}async function E(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|read_file",{path:n instanceof URL?n.toString():n,options:e});return t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}async function _(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|read_text_file",{path:n instanceof URL?n.toString():n,options:e}),o=t instanceof ArrayBuffer?t:Uint8Array.from(t);return new TextDecoder(e?.encoding??"utf-8").decode(o)}async function x(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=n instanceof URL?n.toString():n;return await Promise.resolve({path:t,rid:null,async next(){const o=new TextDecoder(e?.encoding??"utf-8");if(this.rid===null){const l=o.encoding;this.rid=await i("plugin:fs|read_text_file_lines",{path:t,options:e!=null?{...e,encoding:l}:void 0})}let r;try{r=await i("plugin:fs|read_text_file_lines_next",{rid:this.rid})}catch(l){throw this.rid=null,l}const s=r instanceof ArrayBuffer?new Uint8Array(r):Uint8Array.from(r),f=s[s.byteLength-1]===1;return f?(this.rid=null,{value:null,done:f}):{value:o.decode(s.slice(0,s.byteLength-1)),done:f}},async return(){if(this.rid!==null){const o=this.rid;this.rid=null,await new a(o).close()}return{value:null,done:!0}},[Symbol.asyncIterator](){return this}})}async function v(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|remove",{path:n instanceof URL?n.toString():n,options:e})}async function M(n,e,t){if(n instanceof URL&&n.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|rename",{oldPath:n instanceof URL?n.toString():n,newPath:e instanceof URL?e.toString():e,options:t})}async function C(n,e){const t=await i("plugin:fs|stat",{path:n instanceof URL?n.toString():n,options:e});return u(t)}async function k(n,e){const t=await i("plugin:fs|lstat",{path:n instanceof URL?n.toString():n,options:e});return u(t)}async function F(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|truncate",{path:n instanceof URL?n.toString():n,len:e,options:t})}async function z(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");if(e instanceof ReadableStream){const o=await p(n,{read:!1,create:!0,write:!0,...t,truncate:!t?.append}),r=e.getReader();try{for(;;){const{done:s,value:f}=await r.read();if(s)break;await o.write(f)}}finally{r.releaseLock(),await o.close()}}else await i("plugin:fs|write_file",e,{headers:{path:encodeURIComponent(n instanceof URL?n.toString():n),options:JSON.stringify(t)}})}async function I(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const o=new TextEncoder;await i("plugin:fs|write_text_file",o.encode(e),{headers:{path:encodeURIComponent(n instanceof URL?n.toString():n),options:JSON.stringify(t)}})}async function H(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|exists",{path:n instanceof URL?n.toString():n,options:e})}class y extends a{}async function L(n,e,t){const o=Array.isArray(n)?n:[n];for(const c of o)if(c instanceof URL&&c.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=new R;r.onmessage=e;const s=await i("plugin:fs|watch",{paths:o.map(c=>c instanceof URL?c.toString():c),options:t,onEvent:r}),f=new y(s);return()=>{f.close()}}async function J(n,e,t){return await L(n,e,{delayMs:2e3,...t})}async function N(n,e,t){return await L(n,e,{...t,delayMs:void 0})}async function O(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|size",{path:n instanceof URL?n.toString():n,options:e})}async function V(n){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|start_accessing_security_scoped_resource",{path:n instanceof URL?n.toString():n})}async function h(n){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|stop_accessing_security_scoped_resource",{path:n instanceof URL?n.toString():n})}export{w as BaseDirectory,g as FileHandle,d as SeekMode,S as copyFile,b as create,H as exists,k as lstat,A as mkdir,p as open,T as readDir,E as readFile,_ as readTextFile,x as readTextFileLines,v as remove,M as rename,O as size,V as startAccessingSecurityScopedResource,C as stat,h as stopAccessingSecurityScopedResource,F as truncate,J as watch,N as watchImmediate,z as writeFile,I as writeTextFile};