Light Dark

Functions

info core

fn (): RunInfo

Return information about the current run execution context.

Returns a RunInfo containing details about the run, stream, build, project, env, user, and org. Optional fields return null when not available.

Example

i info()
i.run.id              // UUID of the current run
i.run.type            // "call", "event", "schedule", "run", "eval", or "repl"
i.run.status          // "running"
i.run.start-time      // Instant when the run started
i.run.retry-attempt   // Current retry attempt (0 = first try, 1 = first retry, etc.)
i.run.max-retries     // Maximum retries from function meta (0 = no retries)
i.run.retry-delay     // Delay between retries in milliseconds
i.run.origin-run-id   // UUID of original run if this is a retry (null otherwise)
i.build.hash          // Build hash (null if not available)
i.project.name        // Project name (null if not available)
i.env.id              // Environment UUID (null if not available)
i.env.name            // Environment name (e.g. "development", "production")
i.org.id              // Organization UUID (null if not available)
i.org.slug            // Organization slug (e.g. "local", "acme-inc")

is-inline-run core

fn ()

Is the run type a direct run type (vs. scheduled or event triggered)

is-local-dev core

fn (): Bool

Check if running in local development mode.

Returns true when the org slug is "local" and the environment name is "development", which is the default configuration for hot dev and hot run.

Useful for switching behavior between local development and production deployments.

Example

// Use polling in local dev, webhooks in production
if(is-local-dev(), start-polling(), use-webhooks())

Types

Cancellation core

Cancellation type {
    $msg: Str,
    $data: Any
}

Represents a cancelled run execution. Produced by cancel() when called in a run context.

Fields

  • $msg — Human-readable cancellation message
  • $data — Optional structured data

Example

c cancel("User cancelled", {"reason": "timeout"})
c.$msg    // "User cancelled"
c.$data   // {"reason": "timeout"}

Failure core

Failure type {
    $msg: Str,
    $err: Any
}

Represents a failed run execution. Produced by fail() when called in a run context.

Fields

  • $msg — Human-readable error message
  • $err — Structured error data (any type)

Example

f fail("Connection failed", {"host": "api.example.com"})
f.$msg   // "Connection failed"
f.$err   // {"host": "api.example.com"}

Run

Run type {
    id: Uuid,
    type: Str,
    status: Str,
    start-time: ::hot::time/Instant,
    retry-attempt: Int,
    max-retries: Int,
    retry-delay: Int,
    origin-run-id: Uuid?
}

RunInfo

RunInfo type {
    run: Run,
    stream: Stream,
    build: Build,
    project: Project,
    env: Env,
    user: User,
    org: Org
}