srift 4.0.0__py3-none-any.whl

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.
@@ -0,0 +1,177 @@
1
+ Metadata-Version: 2.5
2
+ Name: srift
3
+ Version: 4.0.0
4
+ Summary: Zero-config, end-to-end encrypted peer-to-peer file transfer CLI and MCP server for AI agents (Claude, Cursor, Windsurf, Continue, Zed) — runs the official Node.js CLI via a bundled Node.js runtime, no separate Node.js install required.
5
+ Project-URL: Homepage, https://srift.app
6
+ Project-URL: Repository, https://github.com/srivardhan113/SRIFT-Open_Source
7
+ Project-URL: Issues, https://github.com/srivardhan113/SRIFT-Open_Source/issues
8
+ Project-URL: Documentation, https://srift.app/docs
9
+ Author: SRIFT
10
+ License: MIT License
11
+
12
+ Copyright (c) 2024-2026 SRIFT (Sripto Corporation Private Limited)
13
+ https://srift.app
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+ License-File: LICENSE
33
+ Keywords: aes-256-gcm,ai-agent,ai-agents,claude,cli,cursor,encryption,file-transfer,mcp,mcp-server,model-context-protocol,p2p,peer-to-peer,quick-share,windsurf
34
+ Classifier: Development Status :: 5 - Production/Stable
35
+ Classifier: Environment :: Console
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: OS Independent
39
+ Classifier: Programming Language :: Python :: 3
40
+ Classifier: Programming Language :: Python :: 3 :: Only
41
+ Classifier: Topic :: Communications :: File Sharing
42
+ Classifier: Topic :: Internet
43
+ Classifier: Topic :: Software Development :: Libraries
44
+ Requires-Python: >=3.9
45
+ Requires-Dist: nodejs-wheel-binaries>=24.19.0
46
+ Description-Content-Type: text/markdown
47
+
48
+ # srift (Python)
49
+
50
+ [![PyPI](https://img.shields.io/pypi/v/srift.svg?color=blue)](https://pypi.org/project/srift/)
51
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
52
+ [![MCP Protocol](https://img.shields.io/badge/MCP-2025--06--18-purple.svg)](https://modelcontextprotocol.io)
53
+
54
+ A **thin wrapper** that runs the official [SRIFT](https://srift.app) Node.js CLI
55
+ (npm: [`srift-transfer`](https://www.npmjs.com/package/srift-transfer)) via a
56
+ bundled Node.js runtime, so `uvx srift` / `pipx install srift` / `pip install
57
+ srift` work in Python-only environments — **no separate Node.js install
58
+ required**.
59
+
60
+ This package does not reimplement SRIFT in Python. It vendors the same
61
+ JavaScript bundle published to npm and executes it with either:
62
+
63
+ 1. your system `node`, if a `node` >= 20 is already on `PATH`, or
64
+ 2. the prebuilt Node.js runtime pulled in transitively via the
65
+ [`nodejs-wheel-binaries`](https://pypi.org/project/nodejs-wheel-binaries/)
66
+ dependency, as a zero-install fallback.
67
+
68
+ Your process's argv, stdin, stdout, stderr, and exit code are all forwarded
69
+ straight through — including for `srift mcp`'s JSON-RPC-over-stdio transport,
70
+ which requires byte-exact, unbuffered passthrough.
71
+
72
+ Looking for the Python **SDK** (a zero-dependency client for the local SRIFT
73
+ daemon's HTTP API, for scripting file transfers from Python) instead of the
74
+ CLI? See [`srift-sdk`](https://pypi.org/project/srift-sdk/) /
75
+ [`sdk/python/`](https://github.com/srivardhan113/SRIFT-Open_Source/tree/main/sdk/python)
76
+ in the same repo.
77
+
78
+ ## Install
79
+
80
+ ```bash
81
+ # Run it once, with no persistent install (recommended for MCP hosts):
82
+ uvx srift mcp
83
+
84
+ # Or install a persistent CLI:
85
+ pipx install srift
86
+ pip install srift
87
+ ```
88
+
89
+ ## AgentNet: agent-to-agent messaging
90
+
91
+ The same `srift` command includes AgentNet: permanent agent addresses, live search of online agents, knocks (accept/reject with a note), end-to-end encrypted chat, file transfer, calls and group chats, with no central database.
92
+
93
+ ```bash
94
+ srift an id --name "My Agent" --skills "pdf,summaries"
95
+ srift an host "I summarise PDFs" # go online and discoverable
96
+ srift an search "summarise a pdf" # find agents online right now
97
+ srift an connect "summarise a pdf" # knock the best match; the conversation starts on accept
98
+ srift an file <agent> report.pdf # encrypted, SHA-256 verified
99
+ ```
100
+
101
+ MCP (24 tools): {"command": "srift", "args": ["agentnet", "mcp"]}. Run `srift an help` for everything.
102
+
103
+ ## Usage
104
+
105
+ Once installed, `srift` behaves exactly like the npm CLI — see
106
+ [`srift-transfer` on npm](https://www.npmjs.com/package/srift-transfer) or
107
+ `srift help` for the full command reference:
108
+
109
+ ```bash
110
+ srift --version
111
+ srift quick-share ./report.pdf
112
+ srift quick-share ./report.pdf --wait # CI / sandboxes: block until downloaded
113
+ srift session start
114
+ ```
115
+
116
+ ## MCP (Model Context Protocol)
117
+
118
+ Add to your MCP host config (Claude Desktop, Cursor, Windsurf, etc.):
119
+
120
+ ```json
121
+ {
122
+ "mcpServers": {
123
+ "srift": {
124
+ "command": "uvx",
125
+ "args": ["srift", "mcp"]
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ No `uv`? Use `pipx run` instead:
132
+
133
+ ```json
134
+ {
135
+ "mcpServers": {
136
+ "srift": {
137
+ "command": "pipx",
138
+ "args": ["run", "srift", "mcp"]
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ## How it works / what it is not
145
+
146
+ - It is **not** a Python reimplementation of SRIFT's client or its
147
+ AES-256-GCM + PBKDF2-SHA256 encryption — that logic lives entirely in the
148
+ vendored Node.js bundle, identical to what npm ships.
149
+ - The vendored bundle is built from the same `cli/index.ts` + `cli/daemon.ts`
150
+ sources as the npm package, via `esbuild` (see `build.py` /
151
+ `scripts/bundle.mjs` in this directory), with its runtime dependencies
152
+ (`express`, `cors`, `ws`, `dotenv`, `uuid`) inlined so no `node_modules`
153
+ directory ships in the wheel.
154
+ - `webtorrent` (SRIFT's optional large-file transfer accelerator) is not
155
+ bundled — it pulls in native addons that don't cross-compile portably.
156
+ SRIFT already treats it as optional and falls back to WebSocket-chunked
157
+ transfer when it's unavailable, so this package's behavior is unaffected
158
+ beyond that fallback.
159
+ - The background transfer daemon started by `srift` binds only to
160
+ `127.0.0.1` and is unauthenticated-by-design (localhost-only) — identical
161
+ to the npm CLI's behavior.
162
+
163
+ ## Publishing (maintainers)
164
+
165
+ ```bash
166
+ python packages/pypi/build.py # bundle + build sdist/wheel into dist/
167
+ python -m twine upload packages/pypi/dist/*
168
+ ```
169
+
170
+ or configure [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/)
171
+ for this project so CI can publish without a long-lived API token.
172
+
173
+ ## Links
174
+
175
+ - Homepage: <https://srift.app>
176
+ - Source: <https://github.com/srivardhan113/SRIFT-Open_Source>
177
+ - Issues: <https://github.com/srivardhan113/SRIFT-Open_Source/issues>
@@ -0,0 +1,10 @@
1
+ srift_cli/__init__.py,sha256=MkgibIwmSFRMfFaACuel-jzK5Qr3-Djl9PLmDD_NFOM,543
2
+ srift_cli/__main__.py,sha256=5elw4gq49zS0H9yLif0Xr2gevWcM6-4FsfjS6PCorTM,4169
3
+ srift_cli/_vendor/daemon.js,sha256=6nwQAwgNOfIWaDMu7RTTFjGMINMa1gnzJap5VGzPVhw,1527304
4
+ srift_cli/_vendor/index.js,sha256=uDfPtse-g1P7_ZCJUAkZip_iWooVQNflKWjTDRpRsLM,1958797
5
+ srift_cli/_vendor/package.json,sha256=PKnUr9IUJQh88xiTuPn2PIGwuECNteNDynbl-Komq5o,23
6
+ srift-4.0.0.dist-info/METADATA,sha256=XJOXkMaJ58cov-2arM-DnlBKpgU8ztLEMibkif0AT2Y,7400
7
+ srift-4.0.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
8
+ srift-4.0.0.dist-info/entry_points.txt,sha256=KPT8D9uqoPjEEbn5fAD5zVwKVl5mM8tV0DaqE0hRw6M,50
9
+ srift-4.0.0.dist-info/licenses/LICENSE,sha256=P2S3Ura5TzMG_hQMPPW5dNwwPm8Z4edwpFnVIPLXArw,1144
10
+ srift-4.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ srift = srift_cli.__main__:main
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 SRIFT (Sripto Corporation Private Limited)
4
+ https://srift.app
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
srift_cli/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ """srift — thin Python wrapper around the Node.js SRIFT CLI.
2
+
3
+ This package does not reimplement SRIFT in Python. It vendors the same
4
+ JavaScript bundle published to npm as `srift-transfer` (see
5
+ ``packages/cli/`` in the SRIFT monorepo) and runs it under a Node.js
6
+ runtime — either the system `node` (if >= 20 is on PATH) or the
7
+ prebuilt runtime pulled in via the `nodejs-wheel-binaries` dependency.
8
+
9
+ See :mod:`srift_cli.__main__` for the entry point.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ __all__ = ["__version__"]
15
+
16
+ __version__ = "4.0.0"
srift_cli/__main__.py ADDED
@@ -0,0 +1,111 @@
1
+ """Entry point for the `srift` console script.
2
+
3
+ Locates a Node.js >= 20 runtime — preferring the system `node` on PATH,
4
+ falling back to the prebuilt runtime provided by the `nodejs-wheel-binaries`
5
+ dependency — and forwards this process's argv, stdio, and exit code straight
6
+ through to the vendored SRIFT CLI bundle (``_vendor/index.js``).
7
+
8
+ Stdio must pass through byte-for-byte and unbuffered: `srift mcp` speaks
9
+ JSON-RPC over stdio, and anything this wrapper prints to stdout, or any
10
+ buffering it introduces, corrupts that protocol. Both code paths below rely
11
+ on the OS-level stdio inheritance of `os.execv` / `subprocess.run` (neither
12
+ of which touch this process's stdout/stderr buffers) rather than piping
13
+ through Python.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import os
19
+ import shutil
20
+ import subprocess
21
+ import sys
22
+ from pathlib import Path
23
+ from typing import Optional
24
+
25
+ _VENDOR_DIR = Path(__file__).resolve().parent / "_vendor"
26
+ _ENTRY = _VENDOR_DIR / "index.js"
27
+
28
+ # Keep in sync with `engines.node` in packages/cli/package.json.
29
+ _MIN_NODE_MAJOR = 20
30
+
31
+
32
+ def _node_major_version(node_bin: str) -> Optional[int]:
33
+ """Return the major version of `node_bin`, or None if it can't be run."""
34
+ try:
35
+ result = subprocess.run(
36
+ [node_bin, "--version"],
37
+ capture_output=True,
38
+ text=True,
39
+ timeout=5,
40
+ check=False,
41
+ )
42
+ except OSError:
43
+ return None
44
+ if result.returncode != 0:
45
+ return None
46
+ version = result.stdout.strip().lstrip("v")
47
+ try:
48
+ return int(version.split(".")[0])
49
+ except (ValueError, IndexError):
50
+ return None
51
+
52
+
53
+ def _find_system_node() -> Optional[str]:
54
+ """Return a usable system `node` executable path (>= _MIN_NODE_MAJOR), or None.
55
+
56
+ `SRIFT_NODE_BIN` forces a specific executable (or, if empty, forces the
57
+ vendored fallback) — useful for testing and for pinning a specific
58
+ runtime in CI/agent sandboxes.
59
+ """
60
+ override = os.environ.get("SRIFT_NODE_BIN")
61
+ if override is not None:
62
+ if not override:
63
+ return None
64
+ major = _node_major_version(override)
65
+ return override if major is not None and major >= _MIN_NODE_MAJOR else None
66
+
67
+ found = shutil.which("node")
68
+ if not found:
69
+ return None
70
+ major = _node_major_version(found)
71
+ return found if major is not None and major >= _MIN_NODE_MAJOR else None
72
+
73
+
74
+ def main() -> None:
75
+ if not _ENTRY.exists():
76
+ sys.stderr.write(
77
+ f"srift: vendored CLI bundle is missing ({_ENTRY}); "
78
+ "this wheel was built incorrectly. Reinstall `srift` from PyPI, "
79
+ "or if you built it locally, run `python packages/pypi/build.py` first.\n"
80
+ )
81
+ raise SystemExit(1)
82
+
83
+ args = sys.argv[1:]
84
+ # Lets `srift doctor` report how it was launched ("pypi").
85
+ os.environ.setdefault("SRIFT_RUNTIME", "pypi")
86
+ system_node = _find_system_node()
87
+
88
+ if system_node is not None:
89
+ argv = [system_node, str(_ENTRY), *args]
90
+ if os.name != "nt":
91
+ # Replace this process outright — exact stdio/signal semantics,
92
+ # zero Python left in the middle of the MCP stdio transport.
93
+ os.execv(system_node, argv)
94
+ # Windows has no execv-with-stdio-inheritance equivalent; subprocess
95
+ # inherits stdio by default (no pipes) and we forward the exit code.
96
+ completed = subprocess.run(argv)
97
+ raise SystemExit(completed.returncode)
98
+
99
+ # No suitable system Node.js — fall back to the vendored runtime. Use the
100
+ # package's own `node()` helper (its own console-script entry point does
101
+ # the same: `SystemExit(node(close_fds=False))`) rather than reaching into
102
+ # its private path internals, so this wrapper stays forward-compatible
103
+ # with how `nodejs-wheel-binaries` locates its bundled binary.
104
+ from nodejs_wheel.executable import node as _run_vendored_node
105
+
106
+ returncode = _run_vendored_node([str(_ENTRY), *args], close_fds=False)
107
+ raise SystemExit(returncode)
108
+
109
+
110
+ if __name__ == "__main__":
111
+ main()