Client Starlark Runtime
Language
- Go.
Runtime Context
- Client dynamic script execution boundary.
Purpose
- Parses, validates, installs, discovers, executes, and reports Stary/Starlark telemetry scripts.
Key Files
packages/client/internal/script/runtime.gopackages/client/internal/script/executor.gopackages/client/internal/script/types.gopackages/client/internal/script/discovery.gopackages/client/internal/script/validator.gopackages/client/internal/script/report.gopackages/client/internal/script/repl.gopackages/client/internal/script/format.gopackages/client/internal/script/version.gopackages/client/internal/script/builtins_exec.gopackages/client/internal/script/builtins_mqtt.gopackages/client/cmd/nixstasis/install_script.godocs/src/features/starlark-script-system/design.mdpackages/client/README.md
Public Interfaces
- Types:
RuntimeRuntimeConfigExecutorScriptInfoScriptResultScriptErrorScriptWarningFrontMatter
- Functions and methods:
NewRuntime(*Runtime).Builtins(*Runtime).Close(*Runtime).ExecuteNewExecutor(*Executor).ExecuteScriptsDiscoverScriptsSelectLatestScriptsParseStaryFileParseStaryContentCompileSchemaValidateOutputToReportDefaultInstallDirInstallFilenameParseVersionNumberMaxVersion
Dependencies
Internal
internal/telemetry- CLI commands under
cmd/nixstasis/script*.
External
go.starlark.net/starlarkgo.starlark.net/syntaxgo.starlark.net/lib/jsongithub.com/eclipse/paho.mqtt.golanggithub.com/santhosh-tekuri/jsonschema/v5
Client-Server Interaction Details
- Script outputs are transformed into telemetry reports during
pollOnceand sent inside the heartbeattelemetryobject. - Server-issued commands can install or remove scripts through
internal/commands.Handler. .staryscripts contain YAML front matter plus a Starlark body. Validation compiles front matter schemas before installed scripts can contribute telemetry.- Script execution is bounded: executions have a five-second timeout and emit a slow-script warning after three seconds.
script testprints normalized YAML output on success and exits non-zero without telemetry output when validation or execution fails.- Server command batches are correlated by command ID. Duplicate command IDs in a
batch are ignored after the first occurrence and reported as failed with a
duplicate_command_idreason.
Traceable references:
packages/client/internal/script/runtime.go:20-179packages/client/internal/script/executor.go:13-133packages/client/cmd/nixstasis/poll.go:105-126packages/client/cmd/nixstasis/install_script.go:16-77