tacticremote 1.6.1 → 1.6.5
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 +2 -2
- package/bin/tactic-remote-server.js +10 -2
- package/lib/execSafe.js +17 -1
- package/lib/tmuxManager.js +14 -4
- package/lib/validators.js +1 -1
- package/package.json +1 -1
- package/server.js +15 -3
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ That's it. Scan the QR code with the Tactic Remote iOS app to connect.
|
|
|
16
16
|
brew install TacticSpaceTech/tap/tacticremote
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
[](https://apps.apple.com/app/tactic-remote/
|
|
19
|
+
[](https://apps.apple.com/app/tactic-remote-ai-coding/id6758008464)
|
|
20
20
|
|
|
21
21
|
## Prerequisites
|
|
22
22
|
|
|
@@ -56,7 +56,7 @@ The server manages tmux sessions running Claude Code and bridges them to the iOS
|
|
|
56
56
|
|
|
57
57
|
## iOS App
|
|
58
58
|
|
|
59
|
-
Download Tactic Remote from the [App Store](https://apps.apple.com/app/tactic-remote/
|
|
59
|
+
Download Tactic Remote from the [App Store](https://apps.apple.com/app/tactic-remote-ai-coding/id6758008464).
|
|
60
60
|
|
|
61
61
|
## License
|
|
62
62
|
|
|
@@ -51,7 +51,15 @@ const LOGO = [
|
|
|
51
51
|
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
|
|
52
52
|
|
|
53
53
|
function which(cmd) {
|
|
54
|
-
const
|
|
54
|
+
const extraPaths = process.platform === 'darwin'
|
|
55
|
+
? ['/opt/homebrew/bin', '/usr/local/bin', '/opt/homebrew/sbin', '/usr/local/sbin']
|
|
56
|
+
: ['/usr/local/bin'];
|
|
57
|
+
const env = { ...process.env };
|
|
58
|
+
const currentPath = env.PATH || '';
|
|
59
|
+
const missing = extraPaths.filter(p => !currentPath.split(':').includes(p));
|
|
60
|
+
if (missing.length) env.PATH = [...missing, currentPath].join(':');
|
|
61
|
+
|
|
62
|
+
const r = spawnSync('which', [cmd], { encoding: 'utf-8', env, timeout: 5000 });
|
|
55
63
|
return r.status === 0 ? r.stdout.trim() : null;
|
|
56
64
|
}
|
|
57
65
|
|
|
@@ -391,7 +399,7 @@ function printBanner(opts, tunnelUrl) {
|
|
|
391
399
|
}
|
|
392
400
|
console.log('');
|
|
393
401
|
console.log(` ${c.dim}Scan with Tactic Remote app${c.reset}`);
|
|
394
|
-
console.log(` ${c.dim}Get the app:${c.reset} ${c.cyan}https://apps.apple.com/app/tactic-remote/
|
|
402
|
+
console.log(` ${c.dim}Get the app:${c.reset} ${c.cyan}https://apps.apple.com/app/tactic-remote-ai-coding/id6758008464${c.reset}`);
|
|
395
403
|
console.log(` ${c.cyan}https://tacticremote.com${c.reset}`);
|
|
396
404
|
console.log('');
|
|
397
405
|
console.log(line);
|
package/lib/execSafe.js
CHANGED
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { spawn } = require('child_process');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
const TMUX_SOCKET_NAME = process.env.CLAUDE_REMOTE_TMUX_SOCKET || `tacticremote-${os.userInfo().username}`;
|
|
10
|
+
|
|
11
|
+
// Ensure Homebrew paths are in PATH for spawned processes
|
|
12
|
+
(function expandPath() {
|
|
13
|
+
const extra = process.platform === 'darwin'
|
|
14
|
+
? ['/opt/homebrew/bin', '/usr/local/bin', '/opt/homebrew/sbin', '/usr/local/sbin']
|
|
15
|
+
: ['/usr/local/bin'];
|
|
16
|
+
const current = (process.env.PATH || '').split(':');
|
|
17
|
+
const missing = extra.filter(p => !current.includes(p));
|
|
18
|
+
if (missing.length) process.env.PATH = [...missing, ...current].join(':');
|
|
19
|
+
})();
|
|
7
20
|
|
|
8
21
|
/**
|
|
9
22
|
* Execute a command safely using spawn (no shell interpolation)
|
|
@@ -96,7 +109,10 @@ function execSafe(cmd, args = [], opts = {}) {
|
|
|
96
109
|
* @returns {Promise<string>}
|
|
97
110
|
*/
|
|
98
111
|
function execTmux(subCommand, args = []) {
|
|
99
|
-
|
|
112
|
+
const env = { ...process.env };
|
|
113
|
+
delete env.TMUX;
|
|
114
|
+
delete env.TMUX_PANE;
|
|
115
|
+
return execSafe('tmux', ['-L', TMUX_SOCKET_NAME, subCommand, ...args], { env });
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
/**
|
package/lib/tmuxManager.js
CHANGED
|
@@ -568,8 +568,13 @@ async function sendKeyToSession(key, sessionName = DEFAULT_SESSION) {
|
|
|
568
568
|
return { success: false, error: createSessionNotFoundError(sessionName) };
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
-
const
|
|
572
|
-
|
|
571
|
+
const HEX_KEY_MAP = { 'S-Tab': ['1b', '5b', '5a'] }; // ESC [ Z
|
|
572
|
+
if (HEX_KEY_MAP[key]) {
|
|
573
|
+
await tmuxSendKeys(sessionName, ['-H', ...HEX_KEY_MAP[key]]);
|
|
574
|
+
} else {
|
|
575
|
+
const tmuxKey = TMUX_KEY_MAP[key] || key;
|
|
576
|
+
await tmuxSendKeys(sessionName, [tmuxKey]);
|
|
577
|
+
}
|
|
573
578
|
console.log(`⌨️ Sent key [${sessionName}]: ${key}`);
|
|
574
579
|
return { success: true };
|
|
575
580
|
} catch (error) {
|
|
@@ -596,9 +601,14 @@ async function sendKeySequence(sessionName, keys) {
|
|
|
596
601
|
return { success: false, error: createSessionNotFoundError(sessionName) };
|
|
597
602
|
}
|
|
598
603
|
|
|
604
|
+
const HEX_KEY_MAP = { 'S-Tab': ['1b', '5b', '5a'] };
|
|
599
605
|
for (const key of keys) {
|
|
600
|
-
|
|
601
|
-
|
|
606
|
+
if (HEX_KEY_MAP[key]) {
|
|
607
|
+
await tmuxSendKeys(sessionName, ['-H', ...HEX_KEY_MAP[key]]);
|
|
608
|
+
} else {
|
|
609
|
+
const tmuxKey = TMUX_KEY_MAP[key] || key;
|
|
610
|
+
await tmuxSendKeys(sessionName, [tmuxKey]);
|
|
611
|
+
}
|
|
602
612
|
await sleep(50);
|
|
603
613
|
}
|
|
604
614
|
console.log(`⌨️ Sent key sequence [${sessionName}]: ${keys.join(', ')}`);
|
package/lib/validators.js
CHANGED
|
@@ -12,7 +12,7 @@ const SESSION_NAME_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
|
12
12
|
|
|
13
13
|
// Allowed tmux keys whitelist
|
|
14
14
|
const TMUX_KEY_ALLOWLIST = [
|
|
15
|
-
'Enter', 'Escape', 'Tab', 'BTab', 'Space',
|
|
15
|
+
'Enter', 'Escape', 'Tab', 'BTab', 'S-Tab', 'Space',
|
|
16
16
|
'Up', 'Down', 'Left', 'Right',
|
|
17
17
|
'C-c', 'C-d', 'C-u', 'C-z', 'C-m',
|
|
18
18
|
'C-a', 'C-b', 'C-e', 'C-k', 'C-l', 'C-r', 'C-w',
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -34,8 +34,15 @@ const MAX_WS_PAYLOAD = 512 * 1024; // 512KB
|
|
|
34
34
|
*/
|
|
35
35
|
function checkCommand(cmd) {
|
|
36
36
|
const { spawnSync } = require('child_process');
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const extraPaths = process.platform === 'darwin'
|
|
38
|
+
? ['/opt/homebrew/bin', '/usr/local/bin', '/opt/homebrew/sbin', '/usr/local/sbin']
|
|
39
|
+
: ['/usr/local/bin'];
|
|
40
|
+
const env = { ...process.env };
|
|
41
|
+
const currentPath = env.PATH || '';
|
|
42
|
+
const missing = extraPaths.filter(p => !currentPath.split(':').includes(p));
|
|
43
|
+
if (missing.length) env.PATH = [...missing, currentPath].join(':');
|
|
44
|
+
|
|
45
|
+
const result = spawnSync('which', [cmd], { env, timeout: 5000 });
|
|
39
46
|
return result.status === 0;
|
|
40
47
|
}
|
|
41
48
|
|
|
@@ -157,10 +164,15 @@ class ClaudeRemoteServer {
|
|
|
157
164
|
ws.isAlive = true;
|
|
158
165
|
ws.on('pong', () => { ws.isAlive = true; });
|
|
159
166
|
|
|
167
|
+
const capabilities = [];
|
|
168
|
+
if (this.claudeAvailable) capabilities.push('structured_json');
|
|
169
|
+
if (this.tmuxAvailable) capabilities.push('tmux');
|
|
170
|
+
|
|
160
171
|
this.wsHandler.sendToClient(ws, {
|
|
161
172
|
type: 'connected',
|
|
162
173
|
path: this.clientState.get(clientId).currentPath,
|
|
163
|
-
status: 'ready'
|
|
174
|
+
status: 'ready',
|
|
175
|
+
capabilities
|
|
164
176
|
});
|
|
165
177
|
|
|
166
178
|
ws.on('message', (data) => {
|