itwillsync 0.1.0 → 1.0.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/README.md +127 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/web-client/assets/{index-BfDx-XdF.css → index-C_FteUer.css} +1 -1
- package/dist/web-client/assets/index-D5whIj_8.js +84 -0
- package/dist/web-client/index.html +2 -2
- package/package.json +12 -2
- package/dist/web-client/assets/index-C4jOqPS9.js +0 -66
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# itwillsync
|
|
2
|
+
|
|
3
|
+
Sync any terminal-based coding agent to your phone over local network. Open source, agent-agnostic, zero cloud.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npx itwillsync -- claude
|
|
7
|
+
npx itwillsync -- aider
|
|
8
|
+
npx itwillsync -- bash
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
1. Run `itwillsync` with your agent command
|
|
14
|
+
2. A QR code appears in your terminal
|
|
15
|
+
3. Scan it on your phone — opens a terminal in your browser
|
|
16
|
+
4. Control your agent from your phone (or both phone and laptop simultaneously)
|
|
17
|
+
|
|
18
|
+
All data stays on your local network. No cloud, no relay, no account needed.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- Node.js 20+
|
|
23
|
+
- Any terminal-based coding agent (Claude Code, Aider, Goose, Codex, or just `bash`)
|
|
24
|
+
|
|
25
|
+
## Install & Use
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Run directly (no install needed)
|
|
29
|
+
npx itwillsync -- claude
|
|
30
|
+
|
|
31
|
+
# Or install globally
|
|
32
|
+
npm install -g itwillsync
|
|
33
|
+
itwillsync -- aider --model gpt-4
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Options
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
--port <number> Port to listen on (default: 3456)
|
|
40
|
+
--localhost Bind to 127.0.0.1 only (no LAN access)
|
|
41
|
+
--no-qr Don't display QR code
|
|
42
|
+
-h, --help Show help
|
|
43
|
+
-v, --version Show version
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Remote Access
|
|
47
|
+
|
|
48
|
+
By default, itwillsync is accessible on your local network (same WiFi). For remote access from anywhere:
|
|
49
|
+
|
|
50
|
+
- **Tailscale** (recommended): Install on both devices, access via Tailscale IP
|
|
51
|
+
- **WireGuard / VPN**: Any VPN that puts devices on the same network
|
|
52
|
+
- **SSH tunnel**: `ssh -L 3456:localhost:3456 your-machine`
|
|
53
|
+
|
|
54
|
+
## Security
|
|
55
|
+
|
|
56
|
+
- Each session generates a random 64-character token
|
|
57
|
+
- Token is embedded in the QR code URL
|
|
58
|
+
- All WebSocket connections require the token
|
|
59
|
+
- No data leaves your network
|
|
60
|
+
|
|
61
|
+
## Architecture
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
Your Machine Your Phone
|
|
65
|
+
┌─────────────────────┐ ┌──────────────┐
|
|
66
|
+
│ itwillsync │ WiFi/LAN │ Browser │
|
|
67
|
+
│ ├─ PTY (your agent) │◄────────────►│ xterm.js │
|
|
68
|
+
│ ├─ HTTP server │ WebSocket │ terminal │
|
|
69
|
+
│ └─ WS server │ └──────────────┘
|
|
70
|
+
└─────────────────────┘
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Session Behavior
|
|
74
|
+
|
|
75
|
+
- **No timeout**: Sessions live as long as the agent process runs. No TTL, no idle disconnect.
|
|
76
|
+
- **Multiple devices**: Connect from phone, tablet, and laptop simultaneously — all see the same terminal.
|
|
77
|
+
- **Reconnect**: If your phone disconnects (WiFi switch, screen lock), it auto-reconnects and catches up with recent output.
|
|
78
|
+
- **Keepalive**: WebSocket pings every 30s prevent routers from closing idle connections.
|
|
79
|
+
- **One session per instance**: Run multiple `itwillsync` instances on different ports for multiple agents.
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# 1. Clone and enter the project
|
|
85
|
+
git clone https://github.com/your-username/itwillsync
|
|
86
|
+
cd itwillsync
|
|
87
|
+
|
|
88
|
+
# 2. Use Node 22 (required for node-pty native bindings)
|
|
89
|
+
nvm use # reads .nvmrc
|
|
90
|
+
|
|
91
|
+
# 3. Install dependencies
|
|
92
|
+
pnpm install
|
|
93
|
+
|
|
94
|
+
# 4. Build everything (web client first, then CLI)
|
|
95
|
+
pnpm build
|
|
96
|
+
|
|
97
|
+
# 5. Test it
|
|
98
|
+
node packages/cli/dist/index.js -- bash
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Project Structure
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
packages/
|
|
105
|
+
├── cli/ # Main npm package — PTY, server, auth, CLI
|
|
106
|
+
└── web-client/ # Browser terminal — xterm.js, mobile-friendly CSS
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Contributing
|
|
110
|
+
|
|
111
|
+
1. Fork the repo
|
|
112
|
+
2. Create a feature branch
|
|
113
|
+
3. Make your changes
|
|
114
|
+
4. Run `pnpm build` to verify
|
|
115
|
+
5. Open a PR
|
|
116
|
+
|
|
117
|
+
## Roadmap
|
|
118
|
+
|
|
119
|
+
- [ ] Chat-style input bar + quick action buttons on mobile
|
|
120
|
+
- [ ] Agent detection + structured view for Claude Code
|
|
121
|
+
- [ ] React Native mobile app
|
|
122
|
+
- [ ] VS Code extension adapter
|
|
123
|
+
- [ ] Agent Sync Protocol specification
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -3921,6 +3921,29 @@ function displayQR(url) {
|
|
|
3921
3921
|
// src/index.ts
|
|
3922
3922
|
import { fileURLToPath } from "url";
|
|
3923
3923
|
import { join as join2, dirname } from "path";
|
|
3924
|
+
import { spawn as spawn2 } from "child_process";
|
|
3925
|
+
function preventSleep() {
|
|
3926
|
+
try {
|
|
3927
|
+
if (process.platform === "darwin") {
|
|
3928
|
+
const child = spawn2("caffeinate", ["-i", "-w", String(process.pid)], {
|
|
3929
|
+
stdio: "ignore",
|
|
3930
|
+
detached: true
|
|
3931
|
+
});
|
|
3932
|
+
child.unref();
|
|
3933
|
+
return child;
|
|
3934
|
+
} else if (process.platform === "linux") {
|
|
3935
|
+
return spawn2("systemd-inhibit", [
|
|
3936
|
+
"--what=idle",
|
|
3937
|
+
"--who=itwillsync",
|
|
3938
|
+
"--why=Terminal sync session active",
|
|
3939
|
+
"sleep",
|
|
3940
|
+
"infinity"
|
|
3941
|
+
], { stdio: "ignore" });
|
|
3942
|
+
}
|
|
3943
|
+
} catch {
|
|
3944
|
+
}
|
|
3945
|
+
return null;
|
|
3946
|
+
}
|
|
3924
3947
|
var DEFAULT_PORT = 3456;
|
|
3925
3948
|
function parseArgs(argv) {
|
|
3926
3949
|
const options = {
|
|
@@ -4010,9 +4033,11 @@ async function main() {
|
|
|
4010
4033
|
Connect at: ${url}
|
|
4011
4034
|
`);
|
|
4012
4035
|
}
|
|
4036
|
+
const sleepGuard = preventSleep();
|
|
4013
4037
|
console.log(` Server listening on ${host}:${port}`);
|
|
4014
4038
|
console.log(` Running: ${options.command.join(" ")}`);
|
|
4015
4039
|
console.log(` PID: ${ptyManager.pid}`);
|
|
4040
|
+
console.log(` Sleep prevention: ${sleepGuard ? "active" : "unavailable"}`);
|
|
4016
4041
|
console.log("");
|
|
4017
4042
|
if (process.stdin.isTTY) {
|
|
4018
4043
|
process.stdin.setRawMode(true);
|
|
@@ -4036,6 +4061,7 @@ async function main() {
|
|
|
4036
4061
|
if (process.stdin.isTTY) {
|
|
4037
4062
|
process.stdin.setRawMode(false);
|
|
4038
4063
|
}
|
|
4064
|
+
sleepGuard?.kill();
|
|
4039
4065
|
server.close();
|
|
4040
4066
|
ptyManager.kill();
|
|
4041
4067
|
}
|