tacticremote 1.6.1 → 1.6.6

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 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
- [![Download on the App Store](https://developer.apple.com/assets/elements/badges/download-on-the-app-store.svg)](https://apps.apple.com/app/tactic-remote/id6743597533)
19
+ [![Download on the App Store](https://developer.apple.com/assets/elements/badges/download-on-the-app-store.svg)](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/id6743597533).
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 r = spawnSync('which', [cmd], { encoding: 'utf-8' });
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/id6743597533${c.reset}`);
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
- return execSafe('tmux', [subCommand, ...args]);
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
  /**
@@ -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 tmuxKey = TMUX_KEY_MAP[key] || key;
572
- await tmuxSendKeys(sessionName, [tmuxKey]);
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
- const tmuxKey = TMUX_KEY_MAP[key] || key;
601
- await tmuxSendKeys(sessionName, [tmuxKey]);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tacticremote",
3
- "version": "1.6.1",
3
+ "version": "1.6.6",
4
4
  "description": "Control Claude Code from your iPhone/iPad — server for Tactic Remote",
5
5
  "bin": {
6
6
  "tacticremote": "./bin/tactic-remote-server.js"
@@ -66,7 +66,9 @@ function createHttpHandler(server, handleHookEvent) {
66
66
  try {
67
67
  const rawBody = Buffer.concat(bodyChunks).toString('utf8');
68
68
  const hookData = JSON.parse(rawBody);
69
- handleHookEvent(hookData);
69
+ Promise.resolve(handleHookEvent(hookData)).catch(err => {
70
+ console.error('[hook] handler error:', err.message);
71
+ });
70
72
  res.writeHead(200, { 'Content-Type': 'application/json' });
71
73
  res.end(JSON.stringify({ success: true }));
72
74
  } catch (error) {
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
- // Use 'which' instead of 'command -v' to avoid shell requirement
38
- const result = spawnSync('which', [cmd]);
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) => {
@@ -202,8 +214,28 @@ class ClaudeRemoteServer {
202
214
  console.log(`__CLIENT_COUNT__:${this.externalClients.size}:${this.clients.size}`);
203
215
  }
204
216
 
205
- handleHookEvent(hookData) {
217
+ async handleHookEvent(hookData) {
206
218
  console.log(`🔔 Hook event: ${hookData.event} (${hookData.project})`);
219
+
220
+ // Fallback: if hook didn't provide tmux_session, try to find it by matching project to session cwd
221
+ if (!hookData.tmux_session && hookData.project) {
222
+ try {
223
+ const path = require('path');
224
+ const { listSessions } = require('./lib/tmuxManager');
225
+ const result = await listSessions();
226
+ if (result && result.sessions) {
227
+ const running = result.sessions.find(s => s.running && path.basename(s.path || '') === hookData.project);
228
+ const match = running || result.sessions.find(s => path.basename(s.path || '') === hookData.project);
229
+ if (match) {
230
+ hookData.tmux_session = match.name;
231
+ console.log(`[notify][hook] inferred tmux_session=${match.name} from project=${hookData.project}`);
232
+ }
233
+ }
234
+ } catch (err) {
235
+ console.warn(`[notify][hook] session inference failed: ${err.message}`);
236
+ }
237
+ }
238
+
207
239
  this.lastHookEvent = hookData;
208
240
 
209
241
  // Broadcast in both legacy and event-frame formats for compatibility.
@@ -248,6 +280,7 @@ class ClaudeRemoteServer {
248
280
  title: 'Claude',
249
281
  body: hookData.data.message,
250
282
  project: hookData.project,
283
+ session: hookData.tmux_session,
251
284
  event: 'notification',
252
285
  timestamp: hookData.timestamp
253
286
  });