Capabilities

Context Access

Imported from the upstream Vibescript examples at capabilities/context_access.vibe and runnable in the browser today.

Reference View source
Source capabilities/context_access.vibe
# vibe: 0.2
# uses: ctx

def current_user_id
  ctx.user.id
end

def coach?
  ctx.user.role == "coach"
end

def run
  {
    note: "This example requires the ctx capability which is injected by the host application.",
    functions: ["current_user_id", "coach?"]
  }
end
Output
Press run to execute run from this example.
upstream capabilities browser-runner