diff --git a/recruitment/scripts/onboard b/recruitment/scripts/onboard index 476e5d9..36786ec 100755 --- a/recruitment/scripts/onboard +++ b/recruitment/scripts/onboard @@ -74,6 +74,55 @@ ego-mgr set email "${NAME}@${ROLE}.hangman-lab.top" ego-mgr set agent-id "$AGENT_ID" ego-mgr set date-of-birth "$TODAY" +BINDINGS_LOCK="$HOME/.openclaw/states/bindings.lock" +STATE_DIR="$HOME/.openclaw/states" + +# Wait for bindings.lock to disappear +while [[ -f "$BINDINGS_LOCK" ]]; do + echo "bindings locked, waiting..." + sleep 10 +done + +# Create bindings.lock and update bindings +mkdir -p "$STATE_DIR" +touch "$BINDINGS_LOCK" + +CURRENT_BINDINGS=$(openclaw config get bindings 2>/dev/null || echo "[]") + +# Replace accountId "interviewee" -> "{name}" for this agent +UPDATED_BINDINGS=$(echo "$CURRENT_BINDINGS" | python3 -c " +import sys, json +bindings = json.load(sys.stdin) +for b in bindings: + if b.get('agentId') == '$AGENT_ID' and b.get('match', {}).get('accountId') == 'interviewee': + b['match']['accountId'] = '$NAME' +print(json.dumps(bindings)) +" 2>/dev/null) + +openclaw config set bindings "$UPDATED_BINDINGS" + +rm -f "$BINDINGS_LOCK" + +# Configure discord account for {name} +openclaw config set channels.discord.accounts."$NAME".enabled true +openclaw config set channels.discord.accounts."$NAME".commands.native true +openclaw config set channels.discord.accounts."$NAME".commands.nativeSkills true +openclaw config set channels.discord.accounts."$NAME".token "$BOT_TOKEN" +openclaw config set channels.discord.accounts."$NAME".allowBots true +openclaw config set channels.discord.accounts."$NAME".groupPolicy "open" +openclaw config set channels.discord.accounts."$NAME".streaming.mode "off" +openclaw config set channels.discord.accounts."$NAME".actions.messages true +openclaw config set channels.discord.accounts."$NAME".actions.search true +openclaw config set channels.discord.accounts."$NAME".actions.roles true +openclaw config set channels.discord.accounts."$NAME".actions.channelInfo true +openclaw config set channels.discord.accounts."$NAME".actions.events true +openclaw config set channels.discord.accounts."$NAME".actions.channels true +openclaw config set channels.discord.accounts."$NAME".dmPolicy "open" +openclaw config set channels.discord.accounts."$NAME".allowFrom '["*"]' +openclaw config set channels.discord.accounts."$NAME".dm.enabled true +openclaw config set channels.discord.accounts."$NAME".execApprovals.enabled false +openclaw config set channels.discord.accounts."$NAME".execApprovals.approvers '["*"]' + ~/.openclaw/skills/keycloak-hangman-lab/scripts/create-keycloak-account ~/.openclaw/skills/git-hangman-lab/scripts/create-git-account ~/.openclaw/skills/git-hangman-lab/scripts/link-keycloak