cmd_sidechat_create: Ctrl+J opens chat panel via CDP\n\nSidebar is actually the chat panel (Ctrl+J toggle).\nUse proven Input.dispatchKeyEvent like cmd_sidechat_main.

This commit is contained in:
operator-main
2026-10-04 03:25:37 +00:00
parent b46afcbaea
commit 7938322e6d
+21 -14
View File
@@ -263,21 +263,28 @@ def cmd_sidechat_list(ws):
print(chats[:500]) print(chats[:500])
def cmd_sidechat_create(ws): def cmd_sidechat_create(ws):
"""Create a new side chat via the 'New side chat' button. Returns the new thread URL.""" """Create a new side chat via the '+' button next to 'Side chats' header.
# Use robust sidebar opener with retry (fixes flaky NOSIDEBAR errors) Returns the new thread URL.
Note: Ctrl+J opens the chat panel (which contains Side chats).
Fixed 2026-10-04: sidebar is actually the chat panel, toggled by Ctrl+J.
"""
import time as _time import time as _time
if HAS_SIDECHAT_MANAGER: import json as _json
if not ensure_sidebar(ws): # Ensure chat panel is open via Ctrl+J (CDP Input.dispatchKeyEvent,
print("ERROR: Could not open sidebar after retries", file=sys.stderr) # same proven method as cmd_sidechat_main).
sys.exit(1) # The panel contains Main chat, Side chats, and the + button.
else: ws.send(_json.dumps({
# Fallback to old method "id": 20, "method": "Input.dispatchKeyEvent",
ev(ws, """(() => { "params": {"type": "keyDown", "key": "j", "code": "KeyJ",
const btn = [...document.querySelectorAll("button")].find(b => "ctrlKey": True, "modifiers": 2}
b.textContent.includes("Open chat and side chats") }))
); _json.loads(ws.recv())
if (btn) btn.click(); ws.send(_json.dumps({
})()""") "id": 21, "method": "Input.dispatchKeyEvent",
"params": {"type": "keyUp", "key": "j", "code": "KeyJ",
"ctrlKey": True, "modifiers": 2}
}))
_json.loads(ws.recv())
_time.sleep(2) _time.sleep(2)
# The + button sits next to the "Side chats" header (see screenshot 2026-10-04). # The + button sits next to the "Side chats" header (see screenshot 2026-10-04).
# It's not labeled "New side chat" - find it by proximity to the header text. # It's not labeled "New side chat" - find it by proximity to the header text.