Schnorr: use Poseidon2 instead of Blake2s #95
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ClaudeBox | |
| on: | |
| issue_comment: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| prompt: | |
| description: 'Prompt / instructions for Claude' | |
| required: true | |
| type: string | |
| link: | |
| description: 'Context link (e.g., PR URL, issue URL, external reference)' | |
| required: false | |
| type: string | |
| jobs: | |
| claudebox: | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| startsWith(github.event.comment.body, '/claudebox') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check write access | |
| if: github.event_name == 'issue_comment' | |
| run: | | |
| ASSOCIATION="${{ github.event.comment.author_association }}" | |
| echo "Author association: $ASSOCIATION" | |
| if [[ "$ASSOCIATION" != "OWNER" && "$ASSOCIATION" != "MEMBER" && "$ASSOCIATION" != "COLLABORATOR" ]]; then | |
| echo "ERROR: User does not have write access (association: $ASSOCIATION)" | |
| exit 1 | |
| fi | |
| echo "Access granted." | |
| - name: Add reaction | |
| if: github.event_name == 'issue_comment' | |
| env: | |
| GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }} | |
| run: | | |
| gh api \ | |
| repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions \ | |
| -f content='eyes' || true | |
| - name: Parse command | |
| id: parse | |
| env: | |
| COMMENT_BODY: ${{ github.event.comment.body || '' }} | |
| INPUT_PROMPT: ${{ inputs.prompt || '' }} | |
| INPUT_LINK: ${{ inputs.link || '' }} | |
| run: | | |
| if [ -n "$INPUT_PROMPT" ]; then | |
| PROMPT="$INPUT_PROMPT" | |
| LINK="$INPUT_LINK" | |
| else | |
| PROMPT=$(printf '%s' "$COMMENT_BODY" | sed 's|^/claudebox[[:space:]]*||') | |
| LINK="" | |
| fi | |
| echo "link=$LINK" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "prompt<<PROMPT_EOF" | |
| echo "$PROMPT" | |
| echo "PROMPT_EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| echo "Parsed: prompt=${PROMPT:0:120}" | |
| - name: Post status comment | |
| id: status_comment | |
| if: github.event_name == 'issue_comment' | |
| env: | |
| GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }} | |
| PROMPT_TEXT: ${{ steps.parse.outputs.prompt }} | |
| run: | | |
| ISSUE_NUM="${{ github.event.issue.number }}" | |
| RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| SHORT_PROMPT=$(printf '%.120s' "$PROMPT_TEXT") | |
| BODY="**ClaudeBox**: _${SHORT_PROMPT}_ ... [workflow run]($RUN_URL)" | |
| COMMENT_ID=$(gh api \ | |
| repos/${{ github.repository }}/issues/$ISSUE_NUM/comments \ | |
| -f body="$BODY" \ | |
| --jq '.id') | |
| echo "run_comment_id=$COMMENT_ID" >> "$GITHUB_OUTPUT" | |
| echo "Posted status comment: $COMMENT_ID" | |
| - name: Run ClaudeBox | |
| timeout-minutes: 5 | |
| env: | |
| CLAUDEBOX_URL: ${{ vars.CLAUDEBOX_URL }} | |
| CLAUDEBOX_API_SECRET: ${{ secrets.CLAUDEBOX_API_SECRET }} | |
| CLAUDEBOX_PROMPT: ${{ steps.parse.outputs.prompt }} | |
| CLAUDEBOX_LINK: ${{ steps.parse.outputs.link }} | |
| COMMENT_ID: ${{ github.event.comment.id || '' }} | |
| RUN_COMMENT_ID: ${{ steps.status_comment.outputs.run_comment_id || '' }} | |
| REPO: ${{ github.repository }} | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| AUTHOR: ${{ github.event.comment.user.login || github.actor }} | |
| run: | | |
| PAYLOAD=$(jq -n \ | |
| --arg prompt "$CLAUDEBOX_PROMPT" \ | |
| --arg user "$AUTHOR" \ | |
| --arg comment_id "$COMMENT_ID" \ | |
| --arg run_comment_id "$RUN_COMMENT_ID" \ | |
| --arg repo "$REPO" \ | |
| --arg run_url "$RUN_URL" \ | |
| --arg link "$CLAUDEBOX_LINK" \ | |
| '{prompt: $prompt, user: $user, comment_id: $comment_id, run_comment_id: $run_comment_id, repo: $repo, run_url: $run_url, link: $link}') | |
| # POST to ClaudeBox — returns 202 immediately with log URL | |
| RESPONSE=$(curl -sS -w "\n%{http_code}" \ | |
| -H "Authorization: Bearer ${CLAUDEBOX_API_SECRET}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" \ | |
| "${CLAUDEBOX_URL}/run") | |
| HTTP_CODE=$(echo "$RESPONSE" | tail -1) | |
| BODY=$(echo "$RESPONSE" | head -n -1) | |
| if [ "$HTTP_CODE" -ge 400 ] 2>/dev/null; then | |
| echo "ClaudeBox returned HTTP $HTTP_CODE: $BODY" | |
| exit 1 | |
| fi | |
| LOG_URL=$(echo "$BODY" | jq -r '.log_url // empty') | |
| echo "ClaudeBox session started: $LOG_URL" |