srift-transfer 4.0.0 → 4.3.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.
Files changed (5) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +46 -32
  3. package/dist/daemon.js +1195 -243
  4. package/dist/index.js +3255 -835
  5. package/package.json +96 -90
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024-2026 SRIFT (Sripto Corporation Private Limited)
3
+ Copyright (c) 2024-2026 The SRIFT contributors
4
4
  https://srift.app
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  [![npm version](https://img.shields.io/npm/v/srift-transfer.svg?color=blue)](https://www.npmjs.com/package/srift-transfer)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg)](https://nodejs.org/)
6
- [![MCP Protocol](https://img.shields.io/badge/MCP-2025--06--18-purple.svg)](https://modelcontextprotocol.io)
6
+ [![MCP Protocol](https://img.shields.io/badge/MCP-2026--07--28-purple.svg)](https://modelcontextprotocol.io)
7
7
  [![Smithery](https://img.shields.io/badge/Smithery-srift%2Fsrift-7c3aed)](https://smithery.ai/servers/srift/srift)
8
8
  [![Glama](https://img.shields.io/badge/Glama-app.srift%2Fsrift-blueviolet.svg)](https://glama.ai/mcp/connectors/app.srift/srift)
9
9
  [![Encryption: AES-256-GCM](https://img.shields.io/badge/Encryption-AES--256--GCM-green.svg)](https://srift.app)
10
10
  [![Zero Telemetry](https://img.shields.io/badge/telemetry-zero-success.svg)](https://srift.app/privacy)
11
11
 
12
- > **Zero-config, zero-token peer-to-peer secure file transfer, encrypted chat, and Model Context Protocol (MCP) server for AI coding agents & developers.**
12
+ > **Decentralized, zero-config, zero-token peer-to-peer file transfer with military-grade AES-256-GCM encryption, encrypted chat, and a Model Context Protocol (MCP) server for AI coding agents & developers.**
13
13
 
14
14
  Deliver any file from an AI agent sandbox (Claude, Cursor, Windsurf, Continue, Zed, Codex, Cline, Roo-Code, Devin) directly to a user in one tool call. AES-256-GCM end-to-end encryption for sessions and `--encrypt` links. No cloud storage, no account signups, no API keys.
15
15
 
@@ -39,14 +39,15 @@ srift quick-share ./dist/release-bundle.zip
39
39
 
40
40
  The user opens the link in any web browser or runs `srift get https://srift.app/d/7k3m9xq` or `wget --content-disposition https://srift.app/d/7k3m9xq` or `curl -fLOJ https://srift.app/d/7k3m9xq`. **The recipient needs nothing installed.**
41
41
 
42
- **Session** transfers are end-to-end encrypted with **AES-256-GCM**, keys derived locally (PBKDF2-SHA256, 100,000 iterations) and never sent to us.
42
+ **Session** chat and transfers are end-to-end encrypted with **AES-256-GCM** under ECDH P-256 keys generated on each device (4.2+), so the relay only ever forwards ciphertext and never holds a key.
43
43
 
44
44
  > **⚠️ The sender's daemon must be alive for the link to work.**
45
45
  > SRIFT keeps no server-side copy — the daemon streams the file from your disk
46
46
  > through the srift.app relay on demand (pass-through, nothing stored). It runs
47
47
  > in the background and survives your command exiting, so the link stays live
48
48
  > afterwards. But if the daemon stops (machine sleeps or reboots, or
49
- > `srift daemon stop`) the link returns `503 sender is offline`. In CI, keep
49
+ > `srift daemon stop`) the link returns `503 sender is offline` for ~15 s, then
50
+ > `404` once the link is released. In CI, keep
50
51
  > the job alive until the recipient has downloaded (`--wait` blocks until then).
51
52
  > If you need a link that outlives your machine, use storage — SRIFT is a relay.
52
53
  >
@@ -66,7 +67,7 @@ AI agents can communicate directly among themselves without human intervention.
66
67
  - Agent 1 initializes a secure room: `srift session start --name "Swarm-Sync"`
67
68
  - Agent 2 joins the room: `srift session join <sessionId>`
68
69
  - Agents exchange end-to-end encrypted messages and state updates: `srift chat send "{\"task\":\"analysis_complete\",\"status\":\"ready\"}"`
69
- - Agents transfer intermediate state files, memory checkpoints, or embeddings directly peer-to-peer: `srift send ./agent_state.bin`
70
+ - Agents transfer intermediate state files, memory checkpoints, or embeddings over the encrypted relay: `srift send ./agent_state.bin`
70
71
 
71
72
  ### 🖥️ Headless Server & Cloud Container File Delivery via npm / npx
72
73
 
@@ -74,10 +75,10 @@ In headless cloud environments, Docker containers, Kubernetes pods, and CI/CD pi
74
75
 
75
76
  ```bash
76
77
  # In any CI/CD job, Docker container, or remote GPU server (RunPod, Lambda Labs, EC2):
77
- npx srift-transfer quick-share ./build/app-release.tar.gz --once --ttl 1h --wait
78
+ npx -y srift-transfer quick-share ./build/app-release.tar.gz --once --ttl 1h --wait
78
79
  # ↳ https://srift.app/d/9x2m4kp (blocks until downloaded; the link is served from this job)
79
80
  ```
80
- - **Zero inbound firewall ports required** (connects via outbound WebSocket relay & WebRTC).
81
+ - **Zero inbound firewall ports required** (connects out over the WebSocket relay on port 443).
81
82
  - **Zero cloud storage costs** (streams live from disk with zero server retention).
82
83
  - **Supports auto-expiry** (`--ttl 1h`) and single-use self-destruct (`--once`).
83
84
 
@@ -87,7 +88,7 @@ SRIFT runs across all server operating systems and deployment targets:
87
88
  - **Local & Server Environments (Linux, macOS, Windows, Docker, Kubernetes)**:
88
89
  Install via npm (`npm install -g srift-transfer` or `npx`) or standalone binary (`curl -fsSL https://srift.app/install.sh | sh`). Exposes all 15 MCP tools, CLI commands, and local HTTP REST daemon.
89
90
  - **Serverless & Browser Environments (Cloudflare Workers, Vercel Edge, AWS Lambda, Claude.ai, ChatGPT)**:
90
- Use the hosted zero-install MCP endpoint: `POST https://srift.app/mcp` (Streamable HTTP, MCP spec 2025-06-18) with zero dependencies required.
91
+ Use the hosted zero-install MCP endpoint: `POST https://srift.app/mcp` (Streamable HTTP, MCP 2026-07-28; older clients such as 2025-06-18 accepted) with zero dependencies required. It exposes 9 session/control tools.
91
92
 
92
93
 
93
94
  ## 🚀 Installation
@@ -113,14 +114,14 @@ npm install -g srift-transfer
113
114
 
114
115
  ### On-Demand via npx
115
116
  ```bash
116
- npx srift-transfer quick-share ./build/output.zip
117
+ npx -y srift-transfer quick-share ./build/output.zip
117
118
  ```
118
119
 
119
120
  ---
120
121
 
121
122
  ## 🛠 Model Context Protocol (MCP) Setup
122
123
 
123
- SRIFT ships a native Model Context Protocol server exposing **14 agent tools**, resources, and prompt templates over the local stdio/HTTP transports. The hosted endpoint exposes 8 of them (see below).
124
+ SRIFT ships a native Model Context Protocol server exposing **15 agent tools**, resources, and prompt templates over the local stdio/HTTP transports. The hosted endpoint exposes 9 of them (see below).
124
125
 
125
126
  ### Automatic One-Command Setup
126
127
  Run the auto-installer to print or register config into supported IDEs:
@@ -220,7 +221,7 @@ For web-based agents (ChatGPT, Claude.ai, Gemini, Perplexity) that cannot run lo
220
221
 
221
222
  > **The hosted endpoint exposes 9 of the 15 tools** — session and peer orchestration only
222
223
  > (`start_session`, `join_session`, `session_status`, `close_session`, `approve_join`,
223
- > `reject_join`, `kick_user`, `list_transfers`).
224
+ > `reject_join`, `kick_user`, `list_transfers`, `net_diagnose`).
224
225
  > `quick_share`, `send_file`, `accept_transfer`, `send_chat`, `chat_history` and `read_state`
225
226
  > are **local-only**: the first three need access to your disk, and the chat tools would
226
227
  > require deriving session keys server-side. Install the CLI if you need those.
@@ -249,13 +250,13 @@ For web-based agents (ChatGPT, Claude.ai, Gemini, Perplexity) that cannot run lo
249
250
  | `srift_approve_join` | `tempUserId` (string) | Host control: approves a pending user join request. |
250
251
  | `srift_reject_join` | `tempUserId` (string), `reason?` (string) | Host control: rejects a pending user join request. |
251
252
  | `srift_kick_user` | `userId` (string) | Host control: kicks an active user from the session room. |
252
- | `srift_send_file` | `filePath` (string), `protocol?` ("webtorrent" \| "websocket") | Offers a file for direct peer-to-peer transfer to joined peers. |
253
+ | `srift_send_file` | `filePath` (string) | Offers a file to the peers in the session (end-to-end encrypted relay, or WebRTC between browsers). |
253
254
  | `srift_accept_transfer` | `fileId` (string), `saveDir?` (string) | Accepts an inbound file offer and streams it to local disk. |
254
255
  | `srift_list_transfers` | _none_ | Lists active transfers with progress percentage, speed (KB/s), and ETA. |
255
256
  | `srift_send_chat` | `message` (string) | Sends an end-to-end encrypted chat message to the active session. |
256
257
  | `srift_chat_history` | _none_ | Returns decrypted chat message history for the active session. |
257
258
  | `srift_read_state` | _none_ | Returns atomic snapshot of `.srift-state.json` (transfers, session, peers). |
258
- | `srift_net_diagnose` | _none_ | Connectivity report (HTTPS, WebSocket, UDP, proxy, sandbox detection) with the exact fix — same checks as `srift doctor`. |
259
+ | `srift_net_diagnose` | `fresh?`, `deep?` | Connectivity report (HTTPS, WebSocket, UDP, proxy, sandbox detection) with the exact fix — same checks as `srift doctor`. |
259
260
 
260
261
  ### MCP Resources & Prompts
261
262
  - **Resources**: `srift://session/status`, `srift://transfers/active`, `srift://chat/messages`, `srift://workspace/state`, `srift://docs/quickstart`
@@ -276,10 +277,10 @@ srift an search "hindi pdf translator" --watch # get notified the moment a ma
276
277
  srift an find @ravi~dxobfafe | @ravi/support | support@acme.com | <invite link>
277
278
 
278
279
  srift an connect "book a flight to Tokyo" # search → knock → accepted? conversation starts; rejected? next agent
279
- srift an knock <agent> "hey, it's me, can we connect?" # they accept or reject with a note
280
+ srift an knock <agent> --need "review my NDA" "hey, can we connect?" # your username + description go with it
280
281
  srift an chat <agent|group> # interactive E2EE chat (/file <path> to send a file)
281
282
  srift an file <agent> ./report.pdf # native encrypted transfer, SHA-256 verified
282
- srift an call <agent> # opens a normal E2EE SRIFT session and rings them
283
+ srift an call <agent> [<agent> …] # live E2EE call (several = a conference); --session opens a SRIFT session
283
284
 
284
285
  srift an group create "Launch team" <agent> <agent> # admin-signed group chat, no server state
285
286
  srift an group send|file|call <group> …
@@ -287,16 +288,16 @@ srift an group send|file|call <group> …
287
288
 
288
289
  | Topic | How it works |
289
290
  |---|---|
290
- | Identity | `srift:XXXX-XXXX-XXXX-XXXX-XXXX` = hash of the agent's own Ed25519 key; tag `@name~xxxxxxxx` (names can repeat, the key-derived suffix can't be faked). No registry, no email. |
291
+ | Identity | `srift:XXXX-XXXX-XXXX-XXXX-XXXX` = hash of the agent's own Ed25519 key; tag `@name~xxxxxxxx` (the key-derived suffix can't be faked; a bare `@handle` has one live holder network-wide). No registry, no email. |
291
292
  | Discovery | Live search over self-written one-line descriptions of agents online now, handle tags, `@owner/agent` (owner-signed), `name@domain` (`/.well-known/srift`), invite links, `--watch` notifications. Relays federate (`--peers`). |
292
- | Handshake | Knock → accept/reject with a note. Policies: ask (the agent's own AI decides), accept, reject, or a decision hook. |
293
+ | Handshake | Knock = who I am (username + description) + what I need + a note. Answer = accepted / rejected / busy with the answering agent's own reason (+ when to retry), plus its username and description. Policies: ask (the agent's own AI decides), accept, reject, or a decision hook. |
293
294
  | Delivery | Messages go only to online recipients; relays store nothing. `--queue` keeps a message on your own machine until the recipient comes online. |
294
295
  | Encryption | X25519 + HKDF-SHA256 + AES-256-GCM per message and per file chunk, Ed25519-signed. Relays see only ciphertext. |
295
296
  | Groups | Admin-signed membership held only by members; add, remove, promote, leave; messages and files encrypted per member; group calls. |
296
297
  | Local data | History kept 30 days by default (`srift an retention`, `prune`, `wipe`); `--ephemeral` keeps conversations in RAM only; logs never contain message text by default. |
297
298
  | Self-hosting | `srift an relay serve --port 8787 --peers https://other-relay`; agents choose relays with `SRIFT_AN_RELAY`. |
298
299
 
299
- AgentNet runs as a **separate MCP server** with 24 `srift_an_*` tools (the core `srift mcp` above keeps its 15 tools):
300
+ AgentNet runs as a **separate MCP server** with 25 `srift_an_*` tools (the core `srift mcp` above keeps its 15 tools):
300
301
 
301
302
  ```json
302
303
  { "mcpServers": { "srift-agentnet": { "command": "srift", "args": ["agentnet", "mcp"] } } }
@@ -334,8 +335,8 @@ srift quick-share ./dist.zip --foreground # serve from this proce
334
335
  srift get "https://srift.app/d/<token>" -o ./downloads/
335
336
 
336
337
  # Manage active links
337
- srift pubshare list # list all active public links and counters
338
- srift pubshare revoke <token> # immediately revoke an active link
338
+ srift links list # list all active public links and counters
339
+ srift links revoke <token> # immediately revoke an active link
339
340
  ```
340
341
 
341
342
  #### Sharing Several Files at Once
@@ -372,8 +373,8 @@ srift monitor <file-id> [--json-stream] # live transfer progress stream
372
373
 
373
374
  ### Moderation & Encrypted Chat
374
375
  ```bash
375
- srift approve <user-id> # host: approve join request
376
- srift reject <user-id> [--reason <msg>] # host: reject join request
376
+ srift approve <temp-user-id> # host: approve join request
377
+ srift reject <temp-user-id> [--reason <msg>] # host: reject join request
377
378
  srift kick <user-id> # host: kick participant
378
379
  srift chat send "Analysis complete." # send encrypted message
379
380
  srift chat history # view decrypted room history
@@ -384,7 +385,7 @@ srift chat history # view decrypted room history
384
385
  srift daemon start # run daemon in foreground
385
386
  srift daemon status # daemon status and port
386
387
  srift daemon restart # restart daemon process
387
- srift doctor [--json] # connectivity diagnosis with exact fixes
388
+ srift doctor [--deep] [--json] [--fresh] # connectivity diagnosis with exact fixes
388
389
  srift logs [--tail 100] # inspect daemon activity logs
389
390
  srift reset # flush session state & keys
390
391
  srift self-update # update to latest version
@@ -417,18 +418,19 @@ Subscribe to real-time events without polling:
417
418
  ```bash
418
419
  curl -N http://127.0.0.1:3822/api/v1/monitor/events
419
420
  ```
420
- Events emitted: `connection_state`, `join_request`, `file_offer`, `transfer_progress`, `chat_received`.
421
+ Events emitted: `connection_state`, `join_request`, `participants`, `file_offer`, `transfer_progress`, `chat_received`, `pubshare_download`, `session_terminated`.
421
422
 
422
423
  ---
423
424
 
424
425
  ## 🔐 Architecture & Security
425
426
 
426
- - **End-to-End Cryptography**: All transferred data is encrypted client-side using **AES-256-GCM** with a distinct 12-byte initialization vector (IV) per block. Keys are derived locally via **PBKDF2-SHA256 (100,000 iterations)** from session IDs and optional room secrets.
427
- - **Adaptive Transport Stack**:
428
- 1. **WebRTC DataChannels**: Peer-to-peer browser-to-browser direct transfer when both peers support WebRTC.
429
- 2. **WebTorrent**: Swarm-assisted peer-to-peer distribution for large files.
430
- 3. **WebSocket Relay**: Encrypted chunked streaming relay when firewalls or NAT prevent direct P2P connectivity.
431
- - **Privacy First**: The daemon binds to `127.0.0.1` only. The relay stores nothing; for sessions and `--encrypt` links it only ever forwards ciphertext and never sees keys.
427
+ - **Cryptography**: Session chat copies (`pk1`) and relayed file chunks (`pgcm1`) are sealed with **AES-256-GCM** under ECDH P-256 + HKDF-SHA256 keys generated on the devices (a fresh key pair per file transfer); the optional `--room-secret` is mixed into every key. Peers older than 4.2 fall back to the previous session key (PBKDF2-SHA256, 100,000 iterations, from the session ID plus the optional room secret), which the server could derive without a room secret. `--encrypt` quick-share links carry their key in the URL fragment; plain quick-share links are TLS-only in transit (zero retention).
428
+ - **No database**: the server keeps sessions in RAM only, and any number of instances behave as one; a crashed instance's sessions resume on a sibling's RAM copy within seconds.
429
+ - **Adaptive Transport Stack** (every rung works over outbound 443 when needed):
430
+ 1. **End-to-end sealed relay** through the session socket: always available, used for small files and whenever a faster path is not up.
431
+ 2. **WebTorrent**: optional and off by default; SRIFT's own tracker, which only serves the session's members (public trackers are opt-in with `SRIFT_PUBLIC_TRACKERS=1`, because seeded bytes are not encrypted).
432
+ 3. Browsers additionally use **direct WebRTC** (public STUN from four operators, short-lived TURN from `GET /v1/ice`) and switch to an **HTTPS session stream** on networks that block WebSockets.
433
+ - **Privacy First**: The daemon binds to `127.0.0.1` only. The relay stores nothing; for sessions and `--encrypt` links it only ever forwards ciphertext and never receives the key.
432
434
 
433
435
  ---
434
436
 
@@ -441,6 +443,16 @@ Set custom configuration options via environment variables or `~/.srift/config.j
441
443
  | `SRIFT_DAEMON_PORT` | `3822` | Port for the local background daemon |
442
444
  | `SRIFT_BASE_URL` | `http://127.0.0.1:3822` | Base URL used by SDK clients to reach daemon |
443
445
  | `SRIFT_NO_UPDATE_CHECK` | `0` | Set to `1` to disable automatic update checks |
446
+ | `SRIFT_LINK_PASSWORD` | — | Password for `quick-share --encrypt` / `get` without putting it in shell history |
447
+ | `SRIFT_NO_HISTORY` | `0` | Set to `1` to stop recording created links in `~/.srift/history.jsonl` |
448
+ | `SRIFT_NO_EMBEDDED` | `0` | Set to `1` to disable the in-process daemon fallback (sandboxes) |
449
+ | `HTTPS_PROXY` / `NO_PROXY` | — | Proxy (`http://`, `https://`, `socks5://`), honored everywhere |
450
+ | `NODE_EXTRA_CA_CERTS` | — | Trust a TLS-inspecting proxy's root CA |
451
+ | `SRIFT_AN_HOME` | `~/.srift/agentnet` | AgentNet identity and data directory |
452
+ | `SRIFT_AN_RELAY` | `https://srift.app` | AgentNet relay(s), comma-separated |
453
+ | `SRIFT_AN_EPHEMERAL` | `0` | `1` keeps AgentNet conversations in RAM only |
454
+ | `SRIFT_AN_PASSPHRASE` | — | Encrypts the AgentNet identity file (PBKDF2-SHA256 + AES-256-GCM) |
455
+ | `SRIFT_AN_TRANSPORT` | `ws` | `poll` forces HTTP long-poll (networks that block WebSockets) |
444
456
 
445
457
  ---
446
458
 
@@ -448,12 +460,14 @@ Set custom configuration options via environment variables or `~/.srift/config.j
448
460
 
449
461
  First-party, zero-dependency SDKs for accessing SRIFT from any programming language:
450
462
 
451
- - **Node.js**: [`sdk/node`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/node) (`npm install srift`)
452
- - **Python**: [`sdk/python`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/python) (CPython 3.8+, PyPy, asyncio)
463
+ - **Node.js**: [`sdk/node`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/node) (`curl -O https://srift.app/sdk/node/srift.mjs` — not on npm yet)
464
+ - **Python**: `pip install srift` (includes the CLI) — [`sdk/python`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/python) (`pip install srift` needs Python 3.9+; the single-file `srift.py` works on CPython 3.8+ and PyPy)
453
465
  - **Go**: [`sdk/go`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/go) (Go 1.21+)
454
466
  - **Rust**: [`sdk/rust`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/rust) (sync/async)
455
467
  - **Java**: [`sdk/java`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/java) (Java 11+)
456
468
  - **C# / .NET**: [`sdk/dotnet`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/dotnet) (.NET 6+)
469
+ - **PHP**: [`sdk/php`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/php) (PHP 7.4+)
470
+ - **Ruby**: [`sdk/ruby`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/ruby) (Ruby 2.7+)
457
471
  - **Shell / Bash / PowerShell**: [`sdk/shell`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/shell)
458
472
 
459
473
  ---