Nail sidechat create: direct send, no ID lookup\n\n- cmd_sidechat_create: simplified, just create and return\n- job-dispatch: after create, send via direct API to current chat\n- No thread ID parsing needed; thread lookup via URL for later ops

This commit is contained in:
operator-main
2026-10-04 03:23:34 +00:00
parent b0d6bb3ad8
commit 34082045cc
2 changed files with 69 additions and 54 deletions
+4 -18
View File
@@ -326,24 +326,10 @@ def cmd_sidechat_create(ws):
if not url or "/thread/" not in url:
print(f"ERROR: Sidechat creation did not navigate to thread URL (got: {url})", file=sys.stderr)
sys.exit(1)
# If we got /thread/new (placeholder), the real ID is assigned after
# the first message. Send a system message to trigger ID assignment,
# then re-read the URL.
if url.endswith("/thread/new"):
# Use proven cmd_send to trigger real thread ID
try:
cmd_send(ws, "[System: Side chat created]")
except Exception as e:
print(f"Warning: initial send failed: {e}", file=sys.stderr)
# Poll for URL to change from /thread/new to /thread/<uuid>
for i in range(15):
_time.sleep(1)
url = ev(ws, "window.location.href")
if url and "/thread/" in url and not url.endswith("/thread/new"):
break
if not url or "/thread/" not in url or url.endswith("/thread/new"):
print(f"ERROR: Could not get real thread ID (got: {url})", file=sys.stderr)
sys.exit(1)
# Return the URL (may be /thread/new placeholder).
# The caller sends directly to current chat via cmd_send (no ID needed).
# Thread ID can be looked up later via URL polling if needed.
# Fixed 2026-10-04: don't chase real ID at create time, just create.
print(f"Created: {url}")
return url