Overview
Every successful skill execution triggers two parallel async chains, both dispatched non-blocking viactx.waitUntil. Credits are only deducted on success — failures and rate-limit blocks never charge the user.
Chain A: Credit Deduction
VERCEL_WEBHOOK_URL) is the bridge to uniskill-web’s Supabase instance, writing the transaction into the persistent ledger.
Chain B: Telemetry (Dual Write)
1. recordSkillCall → Supabase RPC
Captures structured per-call statistics in tri-state format:
record_skill_usage:
| Field | Description |
|---|---|
p_user_uid | UUID-validated caller UID (fallback: OFFICIAL_UUID) |
p_skill_name | Normalized skill identifier |
p_source_skill_uid | UUID-validated skill UUID |
p_cost | Credits charged |
p_status_code | HTTP status code |
p_execution_status | SUCCESS / FAILED / SKIPPED |
p_latency_ms | End-to-end request duration |
p_metadata | Debug trace + original skill/user identifiers |
p_display_name | Human-readable skill name snapshot |
p_tags | Skill tag array |
2. saveInvocationLog → Supabase REST
Raw payload audit written directly to the invocations table:
Layered Cache Architecture
UUID Safety
Both telemetry chains validate all UUID fields with a strict regex before writing. Any non-UUID value (e.g. skill name strings,"anonymous") falls back to:
p_metadata.