v0.7.0

Core Concepts

Last updated

HakoRun identifies functions by path, distinguishes versions by timestamp, and offers stored and immediate execution.

Function Paths

Versions

Behavior Description
Version number Unix seconds at upload time, returned as version by /upload
Default run /run/<path> without version runs the latest version
Pinned version /run/<path>?version=<timestamp>; a missing version returns 404
Non-integer version Treated as absent; runs the latest version
Same-second uploads Two uploads to one path within a second share a version, and the later code overwrites the earlier

Stored Run vs Run-Now

Mode Endpoint Code Source Language Check
Stored run POST /run/*path Storage backend (body code/language are overwritten) At upload
Run-now POST /run-now Request body, never stored Per request; code must not be blank

Both modes share one execution path once the code is resolved:

graph LR
    Body[getRunBody capped by CODE_MAX_SIZE] --> Run[run]
    Run -->|stream=false| Once[runScript]
    Run -->|stream=true| SSE[runScriptWithSSE]
    Once --> Cmd[sandbox.SandboxCommand]
    SSE --> Cmd
    Cmd --> Wrapper[wrapper reads stdin]

Execution Lifecycle

中文