Skip to content

Commit 87041ca

Browse files
ThinkOffAppclaude
andcommitted
v0.8.2 — wake skip check is text-area content, not frontmost
@claudemm caught that v0.7.5's frontmost-app skip over-fired: any time the user had Claude.app focused (just READING the room), wakes were dropped. Result: agent looked offline. Replaced with the precise check claudemm originally proposed — query value of text area 1 of group 1 of window 1 via accessibility and skip only when non-empty. Try/silent on failure so accessibility shape mismatches don't block wakes (better to risk a rare mid-typing garble than to silently drop every wake). Applied to all three osascript wake scripts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 89e7d18 commit 87041ca

4 files changed

Lines changed: 62 additions & 23 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ide-agent-kit",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"description": "Built for OpenClaw workflows \u2014 ACP session orchestration, room-triggered automation, comment polling, Discord + Moltbook + GitHub connectors, receipts, exec approvals",
55
"type": "module",
66
"bin": {

scripts/claudemb-wake.sh

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,35 @@ on run argv
4848
set frontApp to name of first application process whose frontmost is true
4949
end tell
5050
51-
-- v0.7.5 — skip the wake when the user is already in the target app.
52-
-- @claudemm observed that wakes injected mid-typing garbled
53-
-- in-progress prompts (e.g. "your poller is con" + injected
54-
-- "check rooms" mid-stream → "youyour poller is constancheckt
55-
-- rooms..."). If Claude.app is already frontmost, the user is
56-
-- actively typing and doesn't need a wake — the next time they
57-
-- send a prompt, the UserPromptSubmit hook will surface the
58-
-- queued /tmp messages anyway.
59-
if frontApp is appName then
60-
log "wake: skipped — " & appName & " already frontmost (user typing)"
51+
-- v0.8.2 — skip the wake ONLY when the user is actively typing
52+
-- (text already in the prompt input), not just because they have
53+
-- Claude.app focused. v0.7.5 used frontmost-app as the proxy and
54+
-- over-fired: skipped wake every time the user was reading the
55+
-- room with Claude.app focused, making the agent look offline.
56+
--
57+
-- Precise check: query the actual text-area content via accessibility
58+
-- and skip only when non-empty. Try/silent on failure so unknown
59+
-- accessibility hierarchies don't block wakes.
60+
set userIsTyping to false
61+
try
62+
tell application "System Events"
63+
tell process appName
64+
-- Walk the typical Electron / Claude.app prompt path. If the
65+
-- accessibility tree shape differs, the inner gets fail and we
66+
-- fall through to the wake (correct default).
67+
set existingText to value of text area 1 of group 1 of window 1
68+
if existingText is not "" and existingText is not missing value then
69+
set userIsTyping to true
70+
end if
71+
end tell
72+
end tell
73+
on error
74+
-- accessibility node not found at expected path — assume not typing,
75+
-- fire the wake. Better to risk a rare mid-typing garble than to
76+
-- silently drop every wake forever.
77+
end try
78+
if userIsTyping then
79+
log "wake: skipped — user is typing in " & appName
6180
return
6281
end if
6382

tools/codex_gui_nudge.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,22 @@ on run argv
1818
-- and tools/gemini_gui_nudge.sh). The old System Events.keystroke routes
1919
-- to whichever process is frontmost at execution time and silently lands
2020
-- in the wrong app if focus contention beats the activation delay.
21-
-- v0.7.5: skip wake if the target app is already frontmost (user typing).
22-
tell application "System Events"
23-
set frontApp to name of first application process whose frontmost is true
24-
end tell
25-
if frontApp is appName then
26-
log "gui_nudge: skipped — " & appName & " already frontmost (user typing)"
21+
-- v0.8.2 — skip wake only when user is actively typing (text in input),
22+
-- not just because target app is frontmost. v0.7.5 over-fired the skip.
23+
set userIsTyping to false
24+
try
25+
tell application "System Events"
26+
tell process appName
27+
set existingText to value of text area 1 of group 1 of window 1
28+
if existingText is not "" and existingText is not missing value then
29+
set userIsTyping to true
30+
end if
31+
end tell
32+
end tell
33+
on error
34+
end try
35+
if userIsTyping then
36+
log "gui_nudge: skipped — user typing in " & appName
2737
return
2838
end if
2939
tell application appName to activate

tools/gemini_gui_nudge.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,22 @@ on run argv
2222
-- landed in the user's actual foreground app with NO error logged.
2323
--
2424
-- Fix: bind the target via `tell process appName / set frontmost true`.
25-
-- v0.7.5: skip wake if the target app is already frontmost (user typing).
26-
tell application "System Events"
27-
set frontApp to name of first application process whose frontmost is true
28-
end tell
29-
if frontApp is appName then
30-
log "gui_nudge: skipped — " & appName & " already frontmost (user typing)"
25+
-- v0.8.2 — skip wake only when user is actively typing (text in input),
26+
-- not just because target app is frontmost. v0.7.5 over-fired the skip.
27+
set userIsTyping to false
28+
try
29+
tell application "System Events"
30+
tell process appName
31+
set existingText to value of text area 1 of group 1 of window 1
32+
if existingText is not "" and existingText is not missing value then
33+
set userIsTyping to true
34+
end if
35+
end tell
36+
end tell
37+
on error
38+
end try
39+
if userIsTyping then
40+
log "gui_nudge: skipped — user typing in " & appName
3141
return
3242
end if
3343
tell application appName to activate

0 commit comments

Comments
 (0)