hello-world-test.sh
bash
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | #!/usr/bin/env bash |
| 2 | ###################################################################### |
| 3 | # hello-world-test.sh |
| 4 | # |
| 5 | # Verifies Paperclip can: |
| 6 | # 1. Read DEEPINFRA_API_KEY from /etc/paperclip/env |
| 7 | # 2. Make an outbound HTTPS call to DeepInfra |
| 8 | # 3. Return a parseable response |
| 9 | # |
| 10 | # Run AS the paperclip user: |
| 11 | # sudo -u paperclip /opt/paperclip/scripts/hello-world-test.sh |
| 12 | # |
| 13 | # Pass condition: prints a one-line model response, exits 0. |
| 14 | # Fail condition: missing key, network error, or bad response. Exits 1. |
| 15 | ###################################################################### |
| 16 | |
| 17 | set -euo pipefail |
| 18 | |
| 19 | ENV_FILE=/etc/paperclip/env |
| 20 | if [[ ! -r "$ENV_FILE" ]]; then |
| 21 | echo "FAIL: $ENV_FILE not readable. Did push-secrets.sh run?" |
| 22 | exit 1 |
| 23 | fi |
| 24 | |
| 25 | # shellcheck disable=SC1090 |
| 26 | set -a |
| 27 | source "$ENV_FILE" |
| 28 | set +a |
| 29 | |
| 30 | if [[ -z "${DEEPINFRA_API_KEY:-}" ]]; then |
| 31 | echo "FAIL: DEEPINFRA_API_KEY missing in $ENV_FILE" |
| 32 | echo "Run: sudo -u paperclip /opt/paperclip/scripts/push-secrets.sh" |
| 33 | exit 1 |
| 34 | fi |
| 35 | |
| 36 | MODEL="${DEEPINFRA_CHAT_MODEL:-Qwen/Qwen2.5-72B-Instruct}" |
| 37 | |
| 38 | echo "[hello-world] Calling DeepInfra ($MODEL)..." |
| 39 | |
| 40 | RESPONSE=$(curl -fsS \ |
| 41 | -X POST "https://api.deepinfra.com/v1/openai/chat/completions" \ |
| 42 | -H "Authorization: Bearer $DEEPINFRA_API_KEY" \ |
| 43 | -H "Content-Type: application/json" \ |
| 44 | --max-time 30 \ |
| 45 | -d "$(cat <<EOF |
| 46 | { |
| 47 | "model": "$MODEL", |
| 48 | "messages": [ |
| 49 | {"role": "system", "content": "You are a one-word smoke test. Reply with exactly: OK"}, |
| 50 | {"role": "user", "content": "smoke test"} |
| 51 | ], |
| 52 | "max_tokens": 4, |
| 53 | "temperature": 0 |
| 54 | } |
| 55 | EOF |
| 56 | )" 2>&1) || { |
| 57 | echo "FAIL: HTTP request failed:" |
| 58 | echo "$RESPONSE" |
| 59 | exit 1 |
| 60 | } |
| 61 | |
| 62 | CONTENT=$(echo "$RESPONSE" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['choices'][0]['message']['content'])" 2>/dev/null || echo "") |
| 63 | |
| 64 | if [[ -z "$CONTENT" ]]; then |
| 65 | echo "FAIL: Could not parse DeepInfra response. Raw:" |
| 66 | echo "$RESPONSE" |
| 67 | exit 1 |
| 68 | fi |
| 69 | |
| 70 | echo "[hello-world] DeepInfra responded: '$CONTENT'" |
| 71 | echo "[hello-world] PASS — Paperclip is wired to DeepInfra." |
| 72 | exit 0 |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago