feat(onboarding): propagate NEEDS_SIGNUP (code 4) through onboard-driver and muse-signin
This commit is contained in:
@@ -15,6 +15,13 @@ The operator then obtains the OTP (via chat with user) and re-runs:
|
||||
|
||||
This keeps credentials out of the automation — the OTP is provided
|
||||
transiently via the operator, never stored.
|
||||
|
||||
Exit codes:
|
||||
0: Success / already logged in
|
||||
2: APPROVAL_NEEDED (OTP prompt reached, awaiting code)
|
||||
3: NEEDS_HUMAN (multi-account selection needs manual choice)
|
||||
4: NEEDS_SIGNUP (account not found / registration required)
|
||||
1: General error
|
||||
"""
|
||||
import json, urllib.request, websocket, time, sys, argparse, importlib.util
|
||||
|
||||
@@ -199,6 +206,35 @@ def main():
|
||||
ws.close()
|
||||
sys.exit(1)
|
||||
else:
|
||||
body_full = ev(ws, "document.body.innerText.slice(0,2000)") or ""
|
||||
body_lower = body_full.lower()
|
||||
signup_cues = [
|
||||
"no account found",
|
||||
"couldn't find your account",
|
||||
"cannot find",
|
||||
"create an account",
|
||||
"create your account",
|
||||
"create account",
|
||||
"sign up",
|
||||
"sign-up",
|
||||
"doesn't have an account",
|
||||
"not registered",
|
||||
"register",
|
||||
"get started"
|
||||
]
|
||||
has_signup_cue = any(cue in body_lower for cue in signup_cues)
|
||||
has_name_or_pwd = ev(ws, """(()=>{
|
||||
const inps = [...document.querySelectorAll('input')];
|
||||
return inps.some(i => (i.placeholder && i.placeholder.toLowerCase().includes('name')) ||
|
||||
(i.name && i.name.toLowerCase().includes('name')) ||
|
||||
(i.type === 'password'));
|
||||
})()""")
|
||||
|
||||
if has_signup_cue or has_name_or_pwd:
|
||||
print(f"NEEDS_SIGNUP: Account does not exist on Muse for {args.email}. Client must sign up first at https://muse.ai", file=sys.stderr)
|
||||
ws.close()
|
||||
sys.exit(4)
|
||||
|
||||
print("No OTP prompt found - check page state", file=sys.stderr)
|
||||
print(f"Body: {body[:200]}", file=sys.stderr)
|
||||
ws.close()
|
||||
|
||||
Reference in New Issue
Block a user