claude-remote 0.1.8 → 0.1.9

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 (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +19 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-remote",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Remote control bridge for Claude Code REPL - drive from phone/WebUI",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -550,10 +550,16 @@ wss.on('connection', (ws, req) => {
550
550
  if (claudeProc) {
551
551
  const text = msg.text;
552
552
  log(`Chat input → PTY: "${text.substring(0, 80)}"`);
553
- if (/^\/clear\s*$/i.test(text.trim())) {
553
+ const isClear = /^\/clear\s*$/i.test(text.trim());
554
+ if (isClear) {
554
555
  markExpectingSwitch();
555
556
  }
556
- broadcast({ type: 'working_started' });
557
+ // Slash commands (e.g. /clear, /help, /compact) are internal CLI
558
+ // commands, not AI turns — the stop hook will never fire, so don't
559
+ // enter the waiting state.
560
+ if (!text.trim().startsWith('/')) {
561
+ broadcast({ type: 'working_started' });
562
+ }
557
563
  claudeProc.write(text);
558
564
  setTimeout(() => {
559
565
  if (claudeProc) claudeProc.write('\r');
@@ -852,6 +858,12 @@ function attachTranscript(target, startOffset = 0) {
852
858
  eventBuffer = [];
853
859
  eventSeq = 0;
854
860
 
861
+ // Clear the expecting-switch state — we've found the new session.
862
+ if (expectingSwitch) {
863
+ expectingSwitch = false;
864
+ if (expectingSwitchTimer) { clearTimeout(expectingSwitchTimer); expectingSwitchTimer = null; }
865
+ }
866
+
855
867
  // If transcript file already has content, mark as catching up so we don't
856
868
  // broadcast working_started for historical user messages.
857
869
  try {
@@ -947,12 +959,14 @@ function startTailing() {
947
959
  const event = JSON.parse(line);
948
960
  // Detect /clear from JSONL events (covers terminal direct input)
949
961
  if (event.type === 'user' || (event.message && event.message.role === 'user')) {
962
+ const content = event.message && event.message.content;
963
+ const isSlashCmd = typeof content === 'string' && content.trim().startsWith('/');
950
964
  // Only broadcast working_started for live (new) user messages,
951
- // not for historical events during catch-up.
952
- if (!tailCatchingUp) {
965
+ // not for historical events during catch-up, and not for slash
966
+ // commands (which are CLI commands, not AI turns).
967
+ if (!tailCatchingUp && !isSlashCmd) {
953
968
  broadcast({ type: 'working_started' });
954
969
  }
955
- const content = event.message && event.message.content;
956
970
  if (typeof content === 'string' && /^\/clear\s*$/i.test(content.trim())) {
957
971
  markExpectingSwitch();
958
972
  }