API Reference
KaimonSlate is normally used through the slate app, its UI, and the agent's slate.* tools. The serving layer below is a small public Julia API for embedding the hub in your own scripts — the app is the everyday entry point.
Serving a notebook
KaimonSlate.NotebookServer.serve_notebook Function
serve_notebook(path; host="127.0.0.1", port=8765, quiet=true, app=false, appdefaults=Dict())Open the notebook at path in a hub and serve it. Blocks until stopped (Ctrl-C shuts the hub and its workers down cleanly). Once the hub is answering HTTP, prints a framed banner with the openable notebook URL (so a launcher like run.jl surfaces a ready, clickable link rather than a bare port). With quiet=true (default) the console stays clean after the banner: the hub's log detail (worker spawns, connects, warnings) goes to a file in the same tmp dir as the worker logs — the banner shows the path; only errors still print.
KaimonSlate.NotebookServer.start_server Function
start_server(path; host="127.0.0.1", port=8765, app=false, appdefaults=Dict()) -> HubStart a hub and open the single notebook at path. Non-blocking; returns the Hub (stop it with stop_hub). The notebook is served at /n/<id> (printed); / is the index. For a blocking launcher use serve_notebook.
app=true serves the notebook as an application: the reading view (markdown, output, figures and live @bind controls — no code, no cell chrome) with the authoring API refused server-side. Presentation defaults for visitors go in appdefaults; build it with app_defaults. See server_app.jl for what app mode does and does not guarantee.
KaimonSlate.NotebookServer.stop_server Function
Stop a hub started by start_server (drains SSE, frees the port).
Hub (multiple notebooks)
A Hub is one HTTP server hosting many notebooks.
KaimonSlate.NotebookServer.start_hub Function
start_hub(; host = "127.0.0.1", port = 8765, app = false, appdefaults = Dict()) -> HubStart one HTTP server that hosts many notebooks, and return the Hub. Notebooks are added and removed while it runs with open_notebook! and close_notebook!; stop_hub shuts it down. This is the layer the slate app itself runs on — reach for it when you are embedding Slate in your own script rather than opening a single notebook with serve_notebook.
host defaults to loopback, so the hub is reachable only from this machine; bind "0.0.0.0" to serve a network. On Linux a loopback connection is served only when it comes from the account running the hub (see _peer_is_owner), which keeps other users of a shared machine out. There is no authentication for network peers — on a non-loopback bind, whatever can reach the port can drive every notebook on it.
app = true serves in application mode: prose, results, figures and live controls, with the authoring routes refused server-side rather than merely hidden. appdefaults (build it with app_defaults) sets what a visitor sees before choosing for themselves.
KaimonSlate.NotebookServer.open_notebook! Function
open_notebook!(hub, path) -> idLoad the notebook at path into the hub (reusing the existing entry if already open) and start its file watcher. Returns the hub id (its /n/<id> route).
KaimonSlate.NotebookServer.close_notebook! Function
Remove a notebook from the hub: drain its SSE connections and drop it.
KaimonSlate.NotebookServer.stop_hub Function
Stop the hub: drain every notebook's SSE connections, then close the server.
Exports
The names using KaimonSlate brings into scope. Their docstrings live in the submodules below, but these are the public spellings.
KaimonSlate.NotebookServer.expand Function
expand(jl_path; target="") -> StringReinflate a standalone .jl (one carrying a Slate.bundle footer) into a project directory at target (default: <jl>.expanded/). A REPO-ROOTED bundle expands to a real git checkout of the original project (its src/, notebooks/, …) with the LIVE notebook cells in place, wired to origin (branch & PR with matching SHAs). A FLAT bundle writes Project + Manifest, any local/ package source, and the notebook at the root. Returns the target dir.
KaimonSlate.ReportEngine.standalone! Function
standalone!(m::Module = @__MODULE__; dir = nothing) -> ModuleInject the notebook-namespace contract into m so a Slate .jl runs as plain Julia (julia notebook.jl / include), Pluto-style. This is the single lever that makes a notebook runnable outside the Slate server: the same _populate_notebook_ns! contract is installed, but the live-only features degrade to no-ops.
@bind x W(…)→x = W's default (empty registry, no browser wiring) — the real bind path, so it works with no special-casing.echart/slate_table/slate_querybuild their display objects as usual (pure constructors); they render viashow/MIME if the run is display-capable, else are inert.slate_refresh/slate_progress/slate_emit/ reactive fires → no-op.@asset/readfile/datadir/@sfileresolve againstdir(the notebook file's directory), defaulting topwd().
Idempotent: a second call — or the Slate engine re-populating the same module — is a no-op (guarded on the __slate_standalone marker), so the emitted preamble never double-injects.
KaimonSlate.NotebookServer.export_app Function
export_app(nb, dir; appdefaults=Dict(), port=0, agent=false, history=false) -> StringWrite a self-contained application for nb into dir (created if absent), and return dir.
The folder holds the notebook's reproducible bundle plus launchers. Running julia run.jl inside it — here, or on any machine you copy it to, needing only Julia 1.12+ — installs the environment, reconstructs the notebook's exact packages, and serves it as an app: prose, results, figures and live controls, with the authoring API refused server-side. Windows users double-click run.bat.
appdefaults sets the presentation a visitor gets before expressing a preference of their own (build it with app_defaults). port pins the port (0 = pick a free one; SLATE_PORT overrides at run time). agent=false by default — an app's readers are not authoring, so the in-notebook agent is off unless you ask for it.
What ships: by default the project's git-TRACKED files — the right default, since it carries the source and leaves out build output, scratch and stray artifacts. include names extra project-relative files or directories to carry anyway. Reach for it when part of the app is deliberately untracked: reference data under the notebook's datadir() is git-ignored by construction (that directory self-ignores so a stray database is never committed), so an app whose samples live there arrives unable to load them —
export_app(nb, dir; include = ["assets/spectra"])A project with no commits has no tracked files at all, so the bundle falls back to a partial copy; export_app warns when it sees that, because the result looks fine until it is deployed.
There is no authentication. Anything that can reach the port can drive the app and read its results; treat "who can reach this port" as the entire access-control story.
KaimonSlate.NotebookServer.app_defaults Function
app_defaults(; theme, fullwidth, pagewidth, figwidth, scrollzoom, wrapoutput) -> Dict{String,Any}The presentation an app's visitor gets before expressing a preference of their own. Pass the result as appdefaults to export_app or start_server.
These are defaults, not enforcement: a visitor who has chosen keeps their choice, because the app's settings popover offers the same reader-facing subset and localStorage still wins.
theme— a Slate palette name ("daylight","midnight","nord", …)fullwidth—truespans the window instead of a constrained reading columnpagewidth/figwidth— px: the reading column, and a cap on rendered figuresscrollzoom— percent;0means the wheel never zooms a chartwrapoutput—truewraps wide text output instead of scrolling it
An unrecognised name is dropped rather than guessed at, so a typo silently has no effect rather than being applied to the wrong setting.
export_app(nb, "dist/myapp"; appdefaults = app_defaults(theme = "midnight", pagewidth = 1400))KaimonSlate.register_extension Function
register_extension(; auto_start=true, enabled=true, force=false, project_path=pkgdir(KaimonSlate)) -> BoolAdd this package to Kaimon's extension registry (extensions.json in Kaimon's config dir — %APPDATA%\Kaimon on Windows, ~/.config/kaimon elsewhere) so Kaimon loads the slate.* tools automatically — no hand-wiring. Idempotent: returns false (nothing written) if Kaimon isn't installed here or the entry already exists, and true when an entry is added. Registration is consented: the slate app prompts on first run (see app.jl), and loads only self-register when spawned AS the extension (see __init__). Call it explicitly to (re)register a specific project_path or to flip auto_start.
Configuration accessors
The persisted settings behind Running the Hub, readable and settable from Julia.
KaimonSlate.KaimonSlate Module
KaimonSlateA warm-session, reactive Julia notebook served as a live browser UI — packaged as a Kaimon extension.
Cells evaluate in isolated modules; edits and @bind widgets drive pruned reactive recompute; Makie/MIME figures and interactive ECharts render inline; the source round-trips to a plain .jl file so the agent and the browser share one source of truth.
It runs out-of-process on HTTP 2.0, independent of Kaimon core's HTTP version — the two talk over the Gate (ZMQ), never a shared HTTP stack.
Standalone use:
using KaimonSlate
serve_notebook("notebook.jl"; port = 8765) # blocksAs a Kaimon extension, create_tools exposes slate.open / slate.list / slate.close to the agent, and Kaimon manages the subprocess lifecycle.
KaimonSlate.SPINNER_CIRCLE Constant
Spinner for the Server row, where the settled states are ● and ○.
Tachikoma's sets are braille, which reads as a different widget sitting where a status dot goes. These are the same Geometric Shapes block as those two marks, so the row keeps one mark that changes rather than swapping in a second kind. All four frames are one cell wide.
KaimonSlate._CONFIG_ROLES Constant
Register the specialist roles defined in <config>/specialists.toml.
A role is a brief and a list of verbs, which is data — so a new kind of specialist should not need a new release. The file is read at startup and nowhere else: a role is the standing instruction an agent is spawned with, and one that changed under a running specialist would leave it working to a brief nobody could read afterwards.
[profiler]
brief = "You are a profiling specialist. …" # or a TOML multi-line string
verbs = ["read", "view", "eval", "spec_ask", "spec_done"]
opening = "Profile {subject}. {task}" # optional; default is the task aloneTwo things this deliberately will NOT let a file do.
It cannot replace a role defined in code. verbs is an allowlist, so redefining debugger with a longer one is a way to widen the narrowest agent in the system by editing a text file.
It cannot choose a permission preset. A preset carrying allowances of its own is UNIONED with verbs on the Claude Code path, so naming a permissive one widens the allowlist and undoes the narrowness the role exists for. Config roles get specialist, which grants nothing by itself.
A verb that names no real tool is dropped and said so. It would otherwise read as a granted capability that silently does nothing, which is the same symptom as a role that does not work.
KaimonSlate._dbg_flag Method
A yes/no tool argument, or missing for anything else. An unrecognized word is refused rather than read as "no", since "no" clears a breakpoint.
KaimonSlate._dbg_mark Method
One breakpoint as file:line, with its condition and whether it is switched off.
KaimonSlate._drop_hub! Method
Stop this process's hub, if it has one, and withdraw its port record.
KaimonSlate._embedded_env_vars Method
_embedded_env_vars(port) -> Vector{Pair{String,Union{String,Nothing}}}The environment the embedded host runs in. Two halves, and both are required:
XDG_*point at the isolated location, which is the whole of Kaimon's own resolution — it has noKAIMON_HOME, its config and cache come fromXDG_CONFIG_HOME/XDG_CACHE_HOMEwithkaimonappended.KAIMONSLATE_*are pinned back to the user's REAL homes. Headless Kaimon spawns the Slate extension as a CHILD, which inherits the vars above, andSlateHomereads the sameXDG_*. Without this the embedded Slate would silently get a fresh config, an empty notebook list and a different publish ledger. It works only becauseSlateHome's precedence putsKAIMONSLATE_<HOME>_HOMEaboveXDG_*.
Also: no periodic index sync. Ollama may not be running, and indexing is not why Slate started a host — same reasoning as the KAIMONSLATE_NO_AUTOINDEX the exported-app runner sets.
KaimonSlate._embedded_root Method
_embedded_root() -> StringWhere the embedded Kaimon lives — config, cache, and its Julia environment. Everything it writes goes under here, so removing this directory removes the install. Override with KAIMONSLATE_KAIMON_HOME.
Deliberately under Slate's CACHE home: it is reconstructible (an env we can rebuild and a config we can rewrite), and nothing a user authored is kept here.
KaimonSlate._ensure_embedded_env! Method
_ensure_embedded_env!(; online = nothing) -> BoolBuild the embedded host's environment if it isn't there. online is fed each line of Pkg output so a caller can narrate it — the first run installs Kaimon and precompiles, which takes minutes and must not look like a hang.
The DEPOT is deliberately shared with the user's own. A private depot would make removal a single rm -rf, but it would also re-download and re-precompile every dependency from scratch, which is the thing most likely to make --ai feel broken. Isolation of config/cache/tmp is what was asked for, and that is orthogonal to where package artifacts live.
KaimonSlate._host_argv Method
The host's command line: Kaimon run as a module, its options after the module's name. --headless is left out for the PTY path, where the point is to keep the host's own TUI, the thing the app then shows.
KaimonSlate._hub_port Method
The port of the hub for this process's preferred port: our own, else a live recorded one, else the preference.
KaimonSlate._manifest_installed Method
_manifest_installed(env) -> BoolWhether every package env's manifest records is present in a depot on DEPOT_PATH (or, for a path dependency, on disk). A file-system check, cheap enough to make before every host start.
KaimonSlate._parse_app_args Method
_parse_app_args(args) -> NamedTupleParse the slate command line. PURE — it starts nothing and prints nothing, so the whole grammar is testable without a terminal or a running host (_app_main below only performs what this decides).
Returns (; action, file, own, ai, ai_port, port, err). action is :run, :help or :status; err is a message when the line is malformed, and non-nothing err means nothing else is valid.
Both flags accept both spellings (--port 9000 / --port=9000, --ai 2828 / --ai=2828) so there is no per-flag convention to remember. --ai's value is OPTIONAL, though, and a notebook path is also positional — so the token after it is INSPECTED rather than consumed, and only counts as the port when it is a bare number in range. That is what keeps slate --ai nb.jl and slate --ai --own meaning what they look like.
KaimonSlate._port_candidates Method
_port_candidates(pref; user) -> Vector{Int}The ports the hub tries, in order: the preference, then a sequence in _PORT_RANGE fixed by the account and the preference. One account lands on the same fallback port each time it starts on a machine, so a browser tab or a port forward stays valid; different accounts spread over the range. Derived with SHA-256 so the sequence does not change with the Julia version.
KaimonSlate._pty_env Method
The environment for a PTY-spawned host: ours, with the isolation overlaid.
pty_spawn passes env to posix_spawn as the WHOLE environment rather than as additions, so this has to start from ENV — unlike addenv, which the headless path uses. Entries set to nothing mean "unset", so they are dropped rather than stringified into the word "nothing".
KaimonSlate._read_hub_record Method
The port recorded for preference pref by a hub that is still running, or nothing.
KaimonSlate._reap_embedded_strays! Method
_reap_embedded_strays!() -> IntKill processes belonging to THIS Slate's embedded host that outlived it, and return how many. The host is supposed to stop its extensions on SIGTERM; when it does not (or when it was killed outright) they are reparented to init and keep holding their hub port, so the next --ai finds the port taken and refuses to start.
Identification is exact rather than by command line: every embedded process was launched with XDG_CONFIG_HOME pointing into our private root, and nothing else on the machine has that. So a Kaimon the user runs themselves, and its Slate extension, are never candidates — which is the whole point, since the two are meant to coexist.
KaimonSlate._screen_tail Method
Last n non-blank lines on a terminal's screen, indented, for an error message.
KaimonSlate._warn_undocumented_tools Method
Say so, now, if any tool would reach a client with no description.
A bare tool is silent in every other way: it registers, dispatches and works, and the only symptom is a model that never calls it because it cannot tell what it does. test_tool_docs.jl is the durable guard; this is for whoever is running right now, since that is who can still fix it.
Descriptions are recovered by scanning the source file UP from each closure's definition line, so the usual cause is something placed between a docstring and its function line — a comment is enough. It also reads empty when the file has been EDITED under a running host: the line numbers come from the compiled method and the text from disk, so they stop agreeing. That case is not a defect and clears on restart, which is why this warns rather than throws.
KaimonSlate._write_kaimon_config! Method
_write_kaimon_config!(port) -> StringWrite the embedded host's config.json (strict, loopback, one API key) and return its path.
Strict because loopback is no boundary on a shared machine: any account on a cluster login node can reach the host's MCP port, and that port runs code. The agents the host spawns are handed the key by Kaimon itself; an agent configured by hand reads it from this file. The key is kept across restarts so such a configuration goes on working.
Written rather than left to Kaimon's own first-run path, which would stop to ask.
created_at is an Int64 field. Kaimon rounds on read, but write an integer anyway.
KaimonSlate.blob_chunk_mb Method
Configured data-channel chunk size in MB; 0.0 = unset (env / 8 MiB default applies).
KaimonSlate.carry_max_s Method
Configured boot-carry per-entry ceiling in seconds; 0.0 = unset (env / 30s default applies).
KaimonSlate.catalog_config Method
The optional "catalog" object in slate.json — where the Extensions gallery gets its data: {"catalog": {"url": "…/catalog.json", "registry": "SlateRegistry", "registry_url": "…"}}. Edited by hand; installed into the server at init. Point all three elsewhere to run a fork's or a mirror's catalog. Empty ⇒ the built-in curated registry.
KaimonSlate.configured_port Method
Persisted hub port; 0 means unset — the KAIMONSLATE_PORT env var or the 8765 default applies.
KaimonSlate.create_tools Method
create_tools(GateTool) -> Vector{GateTool}Tools exposed to the agent under the slate.* namespace. GateTool is passed in so the extension needs no Kaimon dependency — handlers are plain typed functions, reflected into MCP JSON Schema by Kaimon.
KaimonSlate.debug_specialist_only Method
debug_specialist_only() -> BoolMay only the debugging specialist drive a session, or may any agent?
The point of a specialist is an agent that cannot wander: eight verbs and no way to read another cell, refactor something on the way past, or decide the real problem is elsewhere. A generalist holding the same verbs has the whole toolset too, so it does the work itself — reasonably, and then keeps going.
On, a generalist that reaches for a stepping verb is told to summon one instead. Off, it drives directly, which is fewer hops for a narrow bug. A setting rather than a rule because which is better depends on the bug, and that is worth finding out by using both.
KaimonSlate.dedicated_threads_default Method
Whether workers run their machinery on dedicated thread pools by default (persisted; default true).
KaimonSlate.default_kaimon_threads Method
Julia threads for the embedded Kaimon host, as "<compute>,<interactive>".
Set at the spawn rather than inherited: Base.julia_cmd() does not carry --threads, so whatever the hub was started with never reaches the host, while a JULIA_NUM_THREADS=1 in the environment DOES — and one OS thread is the configuration that wedges. The host answers fs/read_text_file for ACP agents, and a read that never returns (a named pipe, a stalled mount) holds an OS thread for good; with too few the scheduler stops, and the process then survives SIGTERM. Two threads carried one such read but failed most runs with two at once, so this is headroom rather than a measured minimum.
Mirrors default_worker_threads and is overridden the same way, by env var. Use --threads= rather than -t at the spawn: only the long spelling takes auto in the first position.
KaimonSlate.embedded_kaimon_running Method
Did THIS process start a Kaimon host that is still running?
Asked before quitting, because the answer changes what quitting MEANS: with a host of ours behind it, leaving stops the host and every notebook it serves; attached to someone else's hub, leaving is just closing a window.
KaimonSlate.embedded_terminal Method
The host's terminal, when it was spawned under a PTY, else nothing.
Headless is still the right shape when nothing can display it — a slate with no tty, or a run that never opens the TUI. Under the TUI the host gets a PTY instead and keeps its own interface, which the app can show in a pane: same process either way, only reachable in one of them.
KaimonSlate.ext_prompt_choice Method
The user's onboarding answer for extension registration: "yes" | "dismissed" | "" (not asked).
KaimonSlate.local_procs Method
local_procs() -> IntHow many task processes a LOCAL sweep may run at once, for this machine.
Each task is a whole Julia loading the project, so what binds is memory rather than cores — which is why the built-in default is far below the core count. A workstation with room to spare says so here once, instead of every cluster definition repeating it. 0 means "work it out from this machine".
A local cluster definition's own procs outranks this, and that is the right order: the setting is a fact about the machine, the definition is a fact about the work.
KaimonSlate.memo_cap_gb Method
Configured durable memo-store cap in GB; 0.0 means unset (worker env / adaptive default applies).
KaimonSlate.on_event Method
on_event(channel, data, session_name)Gate event-bus callback (the extension manifest subscribes to the agent: topic prefix). Kaimon's agent service publishes each agent session's {kind,turn,data} events on agent:<id>; we relay them onto the bound notebook's SSE so the chat pane updates live. Other channels are ignored.
KaimonSlate.on_shutdown Method
on_shutdown()Stop every running notebook server before the extension subprocess exits.
KaimonSlate.parallel_default Method
Whether inter-cell parallel execution is on by default for notebooks (persisted; default true).
KaimonSlate.register_extension Method
register_extension(; auto_start=true, enabled=true, force=false, project_path=pkgdir(KaimonSlate)) -> BoolAdd this package to Kaimon's extension registry (extensions.json in Kaimon's config dir — %APPDATA%\Kaimon on Windows, ~/.config/kaimon elsewhere) so Kaimon loads the slate.* tools automatically — no hand-wiring. Idempotent: returns false (nothing written) if Kaimon isn't installed here or the entry already exists, and true when an entry is added. Registration is consented: the slate app prompts on first run (see app.jl), and loads only self-register when spawned AS the extension (see __init__). Call it explicitly to (re)register a specific project_path or to flip auto_start.
KaimonSlate.remote_config Method
remote_config() -> Dict{String,Any}The optional "remote" object in slate.json — per-host overrides for SSH/connect/tunnel/transfer timing (dial deadlines, ssh ConnectTimeout, tunnel keepalive, blob timeouts, …). Edited by hand; installed into the engine at init. See the _ssh_*/_dial_*/… helpers in remote.jl for every key, its KAIMONSLATE_* env equivalent, and its default. Empty ⇒ every timing keeps its built-in default.
KaimonSlate.render_doc_bundle Method
render_doc_bundle(notebook, dir; backend = :auto, light = "daylight", dark = "midnight",
timeout = 3600) -> DictRun notebook and write its doc bundle to dir (see export_doc_bundle), returning the manifest.
backend:
:hub— through the Slate hub already answering on this machine's hub port.:embedded— start an isolated Kaimon host for the render, and stop it afterwards. The first start on a machine installs and precompiles Kaimon, which takes minutes.:inprocess— in this process, with no worker: no@replaysweeps, so controls export frozen.:auto(default) — the hub already on this machine if there is one (waiting for it if Kaimon is still bringing its Slate extension up), else:embedded.
timeout bounds each notebook's run, in seconds.
KaimonSlate.render_doc_bundles Method
render_doc_bundles(jobs; kw...) -> Vector{Dict}render_doc_bundle for several notebook => dir pairs, sharing one host.
KaimonSlate.repair_registration! Method
repair_registration!() -> BoolRe-point an extension registration that an UPDATE invalidated, returning whether it wrote anything.
A Pkg-installed KaimonSlate lives at <depot>/packages/KaimonSlate/<slug>, and the slug is derived from the version's tree hash — so every upgrade lands in a NEW directory while extensions.json goes on naming the old one. The old slug usually still exists (Pkg keeps it until a gc), so nothing errors: Kaimon simply keeps loading the version that was replaced, and the update appears not to have taken effect.
This is deliberately narrow. It only acts when EVERY entry naming this package is stale — the path is gone, or it is a different slug of the same Pkg install — so a second checkout or a git worktree is never repointed. enabled/auto_start are carried across, because repairing a path must not quietly re-enable an extension the user turned off. A REMOVED entry is not damage but a choice, and is left for the app's prompt.
KaimonSlate.run_location_default Method
The machine's GLOBAL default run-location for new notebooks ("host[,transport]"; "" = local).
KaimonSlate.set_blob_chunk_mb! Method
set_blob_chunk_mb!(mb) -> Float64Persist the memo data-channel chunk size (MB per round-trip) and apply it live — no worker respawn needed (the transfer runs hub-side). Smaller chunks keep a slow uplink responsive; bigger ones amortize the RTT. 0 clears back to the env / 8 MiB default. Settings panel knob.
KaimonSlate.set_carry_max_s! Method
set_carry_max_s!(s) -> Float64Persist the boot-window memo-carry ceiling (max seconds any single entry may spend transferring before the cost gate skips it — the cell recomputes remotely instead) and apply it live. 0 clears back to the env / 30s default. Settings panel knob.
KaimonSlate.set_configured_port! Method
set_configured_port!(port) -> IntPersist the hub port to the Slate config so it survives restarts (read at hub start by both slate and the Kaimon extension subprocess). Does NOT rebind a running hub — the change applies on the next launch or a hub restart. A value ≤ 0 clears the setting (revert to the env var / 8765 default). Precedence at boot: KAIMONSLATE_PORT env > this persisted value > 8765.
KaimonSlate.set_debug_specialist_only! Method
Turn the specialist-only rule on or off, and remember it.
KaimonSlate.set_dedicated_threads_default! Method
set_dedicated_threads_default!(on::Bool) -> BoolPersist whether workers start their own thread pools for the control plane and UI work. Workers spawned afterwards follow it; a notebook's own setting still overrides it.
KaimonSlate.set_ext_prompt_choice! Method
Persist the onboarding answer (see ext_prompt_choice). Returns the stored choice.
KaimonSlate.set_local_procs! Method
Persist how many processes a local sweep may run at once. 0 restores the machine default.
KaimonSlate.set_memo_cap_gb! Method
set_memo_cap_gb!(gb; respawn=true) -> Float64Persist the durable memo-store ceiling (GB) and apply it to future worker spawns; respawn=true recycles running workers so it takes effect immediately. 0 clears the override back to the adaptive default (a quarter of free disk, clamped 2–20 GB). Called by the Kaimon TUI panel.
KaimonSlate.set_parallel_default! Method
set_parallel_default!(on::Bool) -> BoolPersist whether new/re-opened notebooks run cells in parallel by default, and apply it live. The per-notebook Settings toggle still overrides for a specific notebook.
KaimonSlate.set_run_location_default! Method
set_run_location_default!(spec) -> StringPersist the global default run-location (where new notebooks run) to slate.json and apply it live. Per-notebook and per-session overrides still win. Returns the stored spec.
KaimonSlate.set_transfer_warn_mb! Method
Persist the provisioning-size warning threshold (MB). 0 turns the warning off.
KaimonSlate.set_worker_extra_flags! Method
set_worker_extra_flags!(spec; respawn=true) -> StringPersist extra Julia command-line flags appended to every spawned worker (e.g. "--gcthreads=4,1 --heap-size-hint=4G"), apply it to future worker spawns, and — by default — respawn every running notebook's worker so it takes effect immediately. Returns the stored spec. Called by the Kaimon TUI panel via ctx.eval, same pattern as set_worker_threads!.
KaimonSlate.set_worker_threads! Method
set_worker_threads!(spec; respawn=true) -> StringPersist the worker Julia-thread spec (e.g. "4,1" or "auto"), apply it to future worker spawns, and — by default — respawn every running notebook's worker so it takes effect immediately. Returns the stored spec. Called by the Kaimon TUI panel via ctx.eval.
KaimonSlate.set_xfer_confirm_s! Method
Persist the transfer-preview threshold and apply it live. -1 clears to default; 0 disables.
KaimonSlate.start_embedded_kaimon! Method
start_embedded_kaimon!(port; online = nothing) -> BoolBring up kaimon --headless on port, isolated under _embedded_root. Returns whether it was started. Idempotent: a second call with one already running is a no-op.
The host starts the Slate extension itself (headless startup calls start_extensions!), so the sequence is: build the env, write the lax config, register Slate into the ISOLATED registry, spawn. Registration goes through the ordinary register_extension() — it resolves Kaimon's config dir from XDG_CONFIG_HOME at call time, so running it under the isolated environment writes the isolated registry with no special-casing.
KaimonSlate.stop_embedded_kaimon! Method
stop_embedded_kaimon!() -> nothingStop the embedded host, if THIS process started it. A host the user was already running is left alone — _EMBEDDED is only set by start_embedded_kaimon!, so attaching never adopts one.
KaimonSlate.transfer_warn_mb Method
Size at which a provision is worth interrupting someone over, in MB.
ONE number for both the loud hub-log line and the browser's offer to set up transfer rules before the first run pays for them. Two constants for one idea drift apart, and had: they were 512 and 256.
GLOBAL, because it is a fact about the link rather than about a project or a region — the same project is nothing over a LAN and painful over hotel wifi. 0 disables the warning entirely.
KaimonSlate.worker_extra_flags Method
Current extra Julia flags appended to every spawned worker (e.g. "–gcthreads=4,1"); "" means none.
KaimonSlate.worker_threads Method
Current worker Julia-thread spec ("<compute>,<interactive>"); "" means the adaptive default (min(cores,8),2).
KaimonSlate.xfer_confirm_s Method
Configured transfer-preview threshold (s); -1 = unset (env / 60s default), 0 = previews off.
Extension SDK
SlateExtensionsBase is the separate, dependency-light package an extension builds against — see Writing an Extension. It is public API: unlike the submodules below, these are the names a third-party package is meant to use.
SlateExtensionsBase.SlateExtensionsBase Module
SlateExtensionsBaseA lean (Base + stdlib only) SDK for extending Kaimon Slate from an external package — custom @bind widgets, front-end output, browser↔Julia glue, and the per-cell execution context — without depending on the (heavy) KaimonSlate server.
This is the counterpart to AbstractPlutoDingetjes: KaimonSlate depends on it and provides the "meat" (the running server, concrete widgets, the injected notebook namespace), while an extension package depends only on this to build against the contract. Because a @bind spec is already reduced to (kind, params, default) on the wire, this interface is all a widget needs — the Widget struct itself never crosses a process boundary.
Extension points
Controls —
Widget,Choice,Selection; define your own type and overloadto_widgetfor a typed@bindcontrol, andregister_kind!for its value lifecycle.Output —
WebPageandregister_widget_jsship HTML/CSS/JS to the page (live and in exports).Execution context —
slate_contextand its accessors (slate_region,slate_emit,slate_effect, …) read Slate's per-cell context.Reading the notebook's controls —
slate_bind_widget,slate_bind_value,slate_bind_names,slate_on_bindandslate_bind_observable, for an extension that DRAWS a@bindcontrol itself rather than leaving it to Slate's chrome. Pair withhidden(…)at the@bindsite so the notebook does not draw a second copy.
Front-end contract (JS globals; no Julia dependency)
Pair a control with window.slateRegisterWidget("<kind>", {wire, sync, destroy}). Other globals the page exposes: window.slateRegisterEditorExtension, window.slateRegisterCellAction, window.slateRegisterCommand, window.slateCall / window.slateOnStream, and Slate.runFragment / Slate.asset.
Catalog listing
An extension registered in a Slate extension registry is listed in the notebook's Extensions gallery with no work at all — name, version, repo and README blurb are harvested automatically. To enrich the listing (tagline, categories, icon, screenshots, a starter snippet), add an optional SlateExtension.toml at your package root; every key in it is optional.
SlateExtensionsBase.DTYPES Constant
DTYPESOne row per element type Slate can put on a wire as raw bytes, and the only place the set is written down. Everything else is derived from it: the streaming frame's numeric tag (_bin_dtype), the asset manifest's string tag (dtype_tag, which capture.jl's _asset_dtype delegates to), and the browser's decoders (dtype_js, injected as window.__SLATE_DTYPES and read by core.js and wscall.js). Supporting another element type is a row here and nothing else.
Each row is a NamedTuple of (T, code, tag, js):
codeis a WIRE CONTRACT: it is the frame's dtype byte, so rows may be APPENDED but never reordered, renumbered or removed.tagis the asset manifest's spelling (it crosses as JSON, so it is a string rather than a byte).jsnames the TypedArray that reads the bytes back.
SlateExtensionsBase.REPLAY_DOMAIN_CAP Constant
Ceiling on a COMBINATORIAL domain — one whose size grows faster than the control's own step count. A slider's domain is as big as the reader made it and that is the reader's business; a range slider's is quadratic in its steps and a multi-select's is exponential in its options, so the same innocuous control can ask for a domain nothing should enumerate. Past this, bind_domain reports nothing and the author gets @replay's "not finite" error while writing the cell, rather than an export that grinds. The cap is generous: 20 000 positions is a 200-stop range slider, or 14 checkboxes.
SlateExtensionsBase.CellAction Type
CellAction(id; icon, title="", show="", onclick)The wire spec for a per-cell toolbar button. id is a stable, namespaced identifier (both the dedup key and the DOM class — let auto_cell_action derive it from your type via kind_for); icon is the glyph shown (an emoji or HTML entity, like the built-in ▶/🗑 buttons); title is the hover tooltip. show and onclick are raw JavaScript the extension owns (the same trust boundary as shipping a front-end asset):
show— a boolean expression overcell(the cell's JSON:cell.kind,cell.tags, …);""⇒ always shown. e.g."cell.kind === 'code'".onclick— statement(s) run on click, withcellId,cellandeventin scope. e.g."window.myExtInsert(cellId)"(a front-end helper your extension shipped).
Build one directly, or return one from to_cell_action / auto_cell_action.
SlateExtensionsBase.Choice Type
Choice(value, label, index = 0)A labeled option's bound value: .value/.v is the real value, .label/.l the display text, .index/.i its 1-based position.
Prints as its value, and compares and converts as its value when that value is a number, a string or a character — so pick == "a", Dict(opts)[pick] and "$(pick)" all read as you'd expect.
For any other value type, Symbol included, compare pick.value rather than pick. pick == :a is false, and x::Symbol = pick throws. (pick === :a and isequal(pick, :a) were always false, for every value type — .value is the only spelling that has ever been reliable.)
SlateExtensionsBase.HookLogger Type
HookLogger(inner, handle; min_level = nothing, shouldlog = nothing)A logger that passes each record to handle(inner, level, message, _module, group, id, file, line; kwargs...), with inner as the logger it wraps. min_level is its fixed minimum level (inner's when nothing); shouldlog(inner, level, _module, group, id) filters before handle (inner's filter when nothing).
The functions are called in the latest world. That and the methods below living in this package are the point: a package's code compiled into a sysimage runs in the world the image was built in, and a custom compiler (GPUCompiler's, for one) asks the current logger for its level while inferring. A logger type defined after that world, with its methods, is invisible from there; this one is part of the image along with this package.
SlateExtensionsBase.PaletteCommand Type
PaletteCommand(id; label, tag="", key="", run)The wire spec for one ⌘K command-palette entry. id is a stable, namespaced identifier and the dedup key (let auto_palette_command derive it from your type via kind_for). label is the searchable text shown in the list. tag is an optional short badge on the right (the built-ins use panel, export, recipe, …); it defaults to the package name, so a user can type your package's name to see everything it contributes. key is the command's default keyboard shortcut, in CodeMirror chord notation ("Mod-Shift-y", "Alt-ArrowUp", "g g" for a two-stroke sequence; Mod is ⌘ on macOS and Ctrl elsewhere). Leave it empty and the command is palette-only.
Either way the command gets a row in Settings → Keyboard, where the user can bind, rebind or clear it like any built-in — so key is a suggestion, not a claim. Pick one that is free: the host refuses chords the browser keeps for itself, and a chord already taken by a core command will be flagged as a conflict rather than silently winning.
run is raw JavaScript the extension owns (the same trust boundary as shipping a front-end asset): statement(s) executed when the command is chosen, with selectedId (the currently selected cell id, or '') in scope. e.g. "window.myExtPanel()" — a helper your extension shipped.
Build one directly, or return one from to_palette_command / auto_palette_command.
SlateExtensionsBase.PkgAsset Type
PkgAsset <: AbstractStringA package file's text that remembers where it came from — what @pkg_asset returns. It is a string (interpolate it, concatenate it, pass it anywhere a String goes), holding the contents read when it was made. The front-end registry (provide_frontend! and the widget forms) keeps the path and re-reads the file when its mtime changes, so an edit to a registered .js reaches the page on the next manifest pull without restarting the worker.
SlateExtensionsBase.ReplayArray Type
ReplayArray{T,N}An array that also records where it came from: data computed for every value of a control, plus which value produced the slice being held.
Any rank travels — a Vector per control value (one series), a Matrix (a heatmap, a surface, an image), or higher. The slices are stacked along a new trailing dimension, so in column-major order the slice for one control value is a contiguous run and a page can take it as a view rather than a gather.
It behaves exactly like the array it wraps — indexing, broadcasting and serialization are the underlying data — so ordinary Julia code, and a plotting package's trace constructors, need no awareness of it. A renderer looks for it while walking a figure and emits the routing that lets a frozen page re-index the shipped data when the control moves. That is what spares an author from naming a trace or a field: they put the value where it belongs and the walk works out the rest.
LIVE, this holds only the value the control is currently set to — computing the rest would be pure waste, since the kernel can recompute on demand and a hundred-position control would otherwise re-sweep on every edit. It carries an id instead: the export resolves that against the sweep it runs, so the shipped asset is decided where the artifact is, not where the author is typing.
SlateExtensionsBase.ReplayMatrix Type
Two-dimensional ReplayArray.
SlateExtensionsBase.ReplayVector Type
One-dimensional ReplayArray.
SlateExtensionsBase.Selection Type
Selection(items::Vector{Choice})A multi-selection: an ordered, read-only value => label dict. keys → values, values → labels, sel[v] → label, haskey, iteration yields value => label; indices gives each pick's 1-based position in the original option list.
SlateExtensionsBase.SlateBinary Type
SlateBinary(data, meta = (;))Mark a numeric data array for BINARY streaming through slate_emit — raw little-endian bytes on the wire instead of Serialization+JSON, for high-rate frames. meta (a NamedTuple/Dict of small JSON-safe values) rides alongside as a compact header; the browser handler receives {…meta, d} with d a typed array. Element type must be one of Float32/Float64/Int32/Int16/UInt8.
A dense Array is held by REFERENCE, so the frame carries whatever it holds when it is ENCODED — emit and move on, and reusing one buffer across frames costs nothing. Mutating the array between construction and emit therefore changes what is sent; pass snapshot = true for a copy taken at construction instead. Any other AbstractArray (a view, a range, an adjoint) is copied either way, since its bytes aren't contiguous.
slate_emit("field", SlateBinary(frame; i = idx, t = time())) # frame::Matrix{Float32}SlateExtensionsBase.SlateComponentMIME Type
SlateComponentMIME · SlateHtmlMIMEThe two frozen Slate display MIMEs (IANA vendor tree; the suffix matches the payload format). The descriptor VERSION lives in the payload ({v, …}), not the MIME string — one evolving contract.
application/vnd.kaimonslate.component+json— a JSON component descriptor{v, component, props}; the front-end mounts the registered component by name. The blessed path.application/vnd.kaimonslate.html+html— a self-contained HTML fragment; the clean escape hatch that replaces a hand-rolledBase.show(::MIME"text/html").
SlateExtensionsBase.SlateHtmlMIME Type
SlateHtmlMIMEThe MIME a value shows under when its slate_render returns an HTML fragment rather than a component descriptor. The escape hatch beside SlateComponentMIME.
SlateExtensionsBase.UploadedFile Type
UploadedFileA file a reader uploaded through a FileUpload control. path is a real path under the notebook's datadir() — so it opens with CSV.read, open, load, anything — while name keeps what the file was called on the reader's machine.
@bind datafile FileUpload(; accept = ".csv", label = "Data")
datafile === nothing && return # nothing has been uploaded yet
df = CSV.read(datafile.path, DataFrame)Interpolates and converts to its path, so read(datafile, String) and "$datafile" do the obvious thing. Fields: name, path, size (bytes), mime, uploaded (unix time).
SlateExtensionsBase.WebPage Type
WebPage(; html = "", css = "", js = "", obscure = false)A self-contained HTML page composed from CSS/HTML/JS strings. Renders to one text/html output — <style> + body + <script> — identical in the live notebook and a static export. Empty sections are omitted. obscure = true base64-packs the JS behind a tiny decode-and-run bootstrap (trivially reversible; the source files on disk stay plain).
Typically the pieces come from tracked files so they stay debuggable and re-run on edit — in a Slate notebook via @asset, or in an extension package via read(joinpath(pkgdir(@__MODULE__), "assets", "app.js"), String).
SlateExtensionsBase.Widget Type
Widget(kind, params, default)A @bind control's spec: its UI kind::String, display params::Dict{String,Any}, and default value. Build one directly for a custom control kind — pair it with a front-end window.slateRegisterWidget("<kind>", …) renderer — or return one from to_widget on your own type.
SlateExtensionsBase.Widget Type
Widget(T::Type, default=""; params...)Build a Widget whose kind is derived from the widget TYPE T (see kind_for) — the namespaced form. Use it in to_widget so the kind matches the one register_component! registers, with no shared string to keep in sync:
SlateExtensionsBase.to_widget(s::Stars) = Widget(Stars, s.default; max = s.max)SlateExtensionsBase.asset_dirs Method
asset_dirs() -> Dict{String,String}Every package-vendored asset directory declared by the loaded packages (pkg => absolute dir) — a copy, so callers can't mutate the registry. See extension_manifest for what Slate pulls.
SlateExtensionsBase.auto_cell_action Method
auto_cell_action(x; exclude = ()) -> CellActionBuild a CellAction by REFLECTING a struct's fields — the ergonomic to_cell_action body, mirroring auto_widget. Fields named icon, title, show and onclick map to the matching wire fields (icon and onclick are required; title and show default to "" when the struct has no such field); the id is kind_for(typeof(x)), so it's namespaced by your package and can't collide with another extension's button. exclude drops named fields.
SlateExtensionsBase.to_cell_action(a::InsertSnippetButton) = auto_cell_action(a) # id = "MyPackage.InsertSnippetButton"SlateExtensionsBase.auto_palette_command Method
auto_palette_command(x; exclude = ()) -> PaletteCommandBuild a PaletteCommand by REFLECTING a struct's fields — the ergonomic to_palette_command body, mirroring auto_cell_action. Fields named label, tag, key and run map to the matching wire fields (label and run are required; tag and key default to "" when the struct has no such field); the id is kind_for(typeof(x)), so it's namespaced by your package and can't collide with another extension's command. exclude drops named fields.
SlateExtensionsBase.auto_widget Method
auto_widget(x; value = :default, exclude = ()) -> WidgetBuild a Widget by REFLECTING a struct's fields into params — the ergonomic to_widget body when a widget's fields are its UI params. The value field (default :default) becomes the Widget's bound value (not a param); nothing-valued fields are skipped (so an unset Union{Nothing,…} option is omitted); exclude drops named fields. The kind is kind_for(typeof(x)).
struct Stars; max::Int; label::Union{Nothing,String}; default::Int; end
SlateExtensionsBase.to_widget(s::Stars) = auto_widget(s) # params = {max[, label]}, value = defaultOpt-in on purpose — Slate never reflects a struct unless you ask, so an arbitrary value isn't silently turned into a control, and you keep full control (write Widget(kind_for(T), (;…), val) by hand, or use exclude, when not every field is a param).
SlateExtensionsBase.bind_domain Method
bind_domain(w::Widget) -> Vector | NothingEvery value w can take, in the order the control presents them, or nothing when the domain is not finite (free text, an unbounded number field, a date — nothing to enumerate).
The values are WIRE values — what the registry stores and the browser sends back — not the wrapped form a cell sees. A TableSelect enumerates row indices, not row NamedTuples; a RangeSlider enumerates [lo, hi] pairs, not (lo = …, hi = …). That keeps the domain JSON-light enough to ship with the page (which is the whole point of having one) and lets the client match a control's state to a column by comparing exactly what the control reports. wrap_value turns a wire value into the one the author's expression is written against, and @replay applies it on the way in.
This is the single source of truth for a control's domain: an author never restates it, so it cannot drift from the control it belongs to.
SlateExtensionsBase.coerce_bind Method
coerce_bind(w::Widget, v)Coerce a raw browser value against w's registered kind (identity for an unregistered kind).
SlateExtensionsBase.coerce_value Method
coerce_value(::Type{T}, v) -> TCoerce a raw browser value v (arriving as a JSON number / string / bool) to a control's VALUE TYPE T — the type of its Widget's default. Slate applies this automatically, with error- fallback to the default, for any control that registers no custom coerce — so a typed widget (a Stars whose default::Int) gets Int-safe values for free, no lifecycle code. Add a method for your own value type to teach Slate how to coerce it:
SlateExtensionsBase.coerce_value(::Type{RGB}, v) = parse(RGB, string(v))The fallback passes an unrecognised type through untouched (so a Dict/NamedTuple-valued widget is unaffected). Built-in scalar coercions: Integer (rounds/parses), AbstractFloat, Bool, String, Symbol.
SlateExtensionsBase.component Method
component(kind; props...) -> Dict
component(kind, props) -> DictBuild the frozen COMPONENT DESCRIPTOR {v: 1, component: kind, props: {…}} — what slate_render returns for a value that should mount a registered front-end component (the SAME {component, props} a bound widget mounts, so returned + bound values render through identical machinery). props must be JSON-safe (Dicts/Vectors/numbers/strings/bools/nothing — the shapes the descriptor writer emits).
SlateExtensionsBase.slate_render(v::MyView) = component(kind_for(MyView); value = v.x, max = v.max)SlateExtensionsBase.dtype_js Method
dtype_js() -> StringThe dtype table as a JavaScript snippet defining window.__SLATE_DTYPES:
byCode— TypedArray constructors indexed by the binary frame's dtype byte (decoding a frame),byTag— the same, keyed by the asset manifest's string tag (decoding an asset),codeByTag— tag → dtype byte, for the browser's uplink encoder.
Served live at /assets/js/dtypes.js and inlined into static exports, so a browser cannot disagree with Julia about what a dtype means.
Constructors are looked up by NAME at run time rather than referenced directly: a row whose TypedArray the browser doesn't implement (Float16Array on an older engine) resolves to null and that one dtype declines to decode, instead of a ReferenceError taking the whole table — and with it every other dtype — down with it.
SlateExtensionsBase.dtype_tag Method
dtype_tag(T) -> String | NothingThe asset manifest's dtype spelling for element type T ("f32", "i32", …), or nothing when T is not one Slate packs as raw bytes — the caller then falls back to JSON. Derived from DTYPES.
SlateExtensionsBase.encode_binary_frame! Method
encode_binary_frame!(buf, channel, x::SlateBinary) -> bufencode_binary_frame into buf, resized to the frame's length. A buffer reused for frame after frame grows to the largest of them once and is not reallocated after that, so a stream of large frames allocates only the small header per frame.
SlateExtensionsBase.encode_binary_frame Method
encode_binary_frame(channel, x::SlateBinary) -> Vector{UInt8}Serialize a SlateBinary into the self-describing binary streaming frame (see the layout above). The channel + meta + dtype + shape are the header; the array's raw column-major bytes are the payload.
SlateExtensionsBase.ensure_module_frontend! Method
ensure_module_frontend!(m::Module, slate_on) -> BoolInvoke module m's package-global front-end hook, m.__slate_frontend(slate_on), if it defines one and it hasn't already run for this notebook-namespace generation (see ensure_module_frontends!); return whether the module has such a hook. A module without the method contributes nothing (returns false), so — like required_assets — the method's presence doubles as extension-detection. A throwing hook is isolated (caught) so one bad package can't break the manifest pull for the rest.
SlateExtensionsBase.ensure_module_frontends! Method
ensure_module_frontends!(slate_on)Invoke every loaded module's package-global front-end hook (see ensure_module_frontend!) — Slate calls this once per run drain, handing it the notebook namespace's injected slate_on so a hook can register both front-end scripts (via provide_frontend!) and JS→Julia handlers (via slate_on). Hooks must be idempotent (they run every drain).
SlateExtensionsBase.ensure_widget_assets! Method
ensure_widget_assets!(::Type{W})Lazily load W's front-end into the registry (once per process): the first time it's seen, call required_assets and, if it returns a module, register it as a component under kind_for(W). Slate calls this from the @bind/display path — a no-op for built-ins and any type without a method.
SlateExtensionsBase.ext_asset_url Function
ext_asset_url(mod_or_pkg, sub = "") -> StringThe URL a package-vendored asset (declared with provide_assets!) is served at: /ext-assets/<pkg>/<sub>. Prefer the MODULE form — pass @__MODULE__ and the package key is derived (pkg_key), so it can't drift from the string you passed to provide_assets!. The prefix is owned by the SDK (Slate rewrites it to a page-local sibling in a static export); sub="" gives the base URL for the package's tree.
_gl = ext_asset_url(@__MODULE__, "echarts-gl.min.js") # "/ext-assets/GlobeSlate/echarts-gl.min.js"SlateExtensionsBase.extension_manifest Method
extension_manifest() -> NamedTupleEverything this process's loaded packages have registered with Slate that the hub must mirror into the page — Slate pulls it once per run drain and merges it into the notebook. Fields:
frontend: the front-end scripts ((; id, js, esm, kind)each) fromprovide_frontend!/register_widget!/register_component!.esm=true⇒ inject as an ES module; a non-emptykind⇒ a component (Slate wraps itsexport defaultand registers it underkind).assets: the package-vendored asset DIRECTORIES ((; pkg, dir)each) fromprovide_assets!— Slate serves eachdirat/ext-assets/<pkg>/…while the package is loaded and copies it into a static export.imports: the ES-module import-map entries ((; spec, url)each) fromprovide_import!. Slate merges them UNDER the notebook's own@usedeclarations, live and in an export.fences: the markdown fence languages claimed viaregister_fence_renderer!. Slate does not need these to ROUTE a fence — it rewrites every tagged fence and lets the worker answer — but it does need them to INVALIDATE: a markdown cell caches its interpolation results, so a block rendered before an extension was loaded keeps its plain-code fallback until something restales the cell.
Extensible: a new kind of package registration surfaces as another field here, carried by the same query — no new transport per feature.
SlateExtensionsBase.fence_languages Method
fence_languages() -> Vector{String}Every fence language currently claimed, lower-cased and sorted. Introspection only — Slate does not consult it: it rewrites every tagged fence into an interpolation and lets render_fence answer nothing for the ones nobody claimed.
SlateExtensionsBase.fence_renderer Method
fence_renderer(lang) -> f | nothingThe renderer claiming fenced blocks tagged lang, or nothing when none does.
SlateExtensionsBase.frontend_scripts Method
frontend_scripts() -> Dict{String,String}Every front-end script declared by the loaded packages (id => js) — a copy, so callers can't mutate the registry. See extension_manifest for the full record (incl. module-ness) that Slate pulls.
SlateExtensionsBase.html_fragment Method
html_fragment(html) -> SlateHtmlWrap a self-contained HTML string as a slate_render result — the escape hatch for output that isn't a registered component. Prefer component when a front-end component exists.
SlateExtensionsBase.indices Method
indices(sel::Selection) -> Vector{Int}Each selected option's 1-based position in the widget's original option list.
SlateExtensionsBase.js_bundle Method
js_bundle(key, entry; deps, dir, minify=true) -> String | NothingBuild a JavaScript bundle from an ES-module entry and npm deps, returning the built file's path — or nothing when it can't be built, so a caller always has to have a fallback.
The point is TREE-SHAKING. A vendored front-end library is the largest thing in a self-contained export, and the published "dist" builds are deliberately everything-inclusive: plotly.js ships 3D, geo, mapbox and finance whether a notebook draws a scatter plot or not. An extension that knows which parts it actually needs can say so, and get a bundle containing only those:
js_bundle("plotly-$(join(sort(traces), '-'))", """
import Plotly from 'plotly.js/lib/core';
import scatter from 'plotly.js/lib/scatter';
Plotly.register([scatter]);
window.Plotly = Plotly;
""";
deps = Dict("plotly.js" => "2.35.2"), dir = my_cache_dir())Nothing about this is specific to any library: the caller supplies the entry module and the packages it imports, and gets back whatever the bundler produces.
Requires node and npx on PATH; the bundler is esbuild, fetched by npx on first use. Every failure returns nothing — no node, no network, a bad entry, a bundler error. Building a smaller asset is an optimisation, and an export must never fail because an optimisation was unavailable; the caller falls back to whatever it vendors normally.
Cached under dir keyed by a hash of key, the entry source and the deps, so a rebuild happens only when one of those actually changes. key is a readable prefix on the filename, nothing more.
SlateExtensionsBase.kind_for Method
kind_for(T::Type) -> StringThe wire kind derived for a widget TYPE — its module-qualified name (e.g. "StarRating.Stars"). Because it's namespaced by the defining package, two packages can each ship a Stars widget without their kinds colliding. Used by Widget(T, …) and register_component! so a type-based widget never hand-types (and so never clashes on) a bare kind string.
SlateExtensionsBase.on_live_reset Method
on_live_reset(f)Register a zero-arg callback f run right before live outputs are re-rendered for a freshly-connected browser page (see [slate_live_render]). Use it to reset per-page runtime state so the re-render starts clean. Deduped by identity — safe to call every time an extension is enabled.
SlateExtensionsBase.on_worker_reset Method
on_worker_reset(f)Register a zero-arg callback f run when this notebook's worker has been replaced — restarted, or its namespace rebuilt. Anything the extension established in the OLD worker is gone: sessions it owned, handlers it registered in the namespace, resources tied to that process. Use it to rebuild or drop that state.
This is the Julia half; its browser counterpart is slateOnWorkerReset (see assets/js/panels.js), for state the extension put in the PAGE on the old worker's behalf — which only the page can discard, since the process that owned it is the one that died. Deduped by identity, so re-registering on enable is harmless.
SlateExtensionsBase.package_imports Method
package_imports() -> Dict{String,String}Every package-declared ES-module import (specifier => url) — a copy, so callers can't mutate the registry. Carried in extension_manifest; see provide_import!.
SlateExtensionsBase.pkg_key Method
pkg_key(m::Module) -> StringThe stable, package-scoped key for a MODULE — its package root's name (e.g. "GlobeSlate"). The asset analogue of kind_for for a widget type: a module-derived identity an author never hand-types (and so never drifts on, nor clashes with another package's bare string). It's what a package's vendored assets are served under — /ext-assets/<pkg_key>/…. Two packages can't share a name in one session, so the key is unique per process. Pass @__MODULE__ to provide_assets! / ext_asset_url.
SlateExtensionsBase.provide_assets! Method
provide_assets!(mod_or_pkg, dir) -> StringDeclare a directory of front-end assets that Slate should SERVE while this package is loaded — call it from your module's __slate_frontend hook (or __init__). Prefer the MODULE form: pass @__MODULE__ and the package key is derived (pkg_key) — the same module-scoped identity kind_for gives a widget type — so there's no hand-typed string to keep in sync with your ext_asset_url calls. The files are served at /ext-assets/<pkg>/<subpath> live and copied into a static export; dir is an absolute directory, typically @pkg_dir. Returns the package's base URL:
function __slate_frontend(slate_on)
provide_assets!(@__MODULE__, @pkg_dir("assets"))
# build urls with ext_asset_url(@__MODULE__, "echarts-gl/echarts-gl.min.js")
endFor a front-end LIBRARY too large or multi-file to inline as a provide_frontend! string (Cesium, echarts-gl, anything shipping fonts/workers/wasm). A re-declaration of the same package replaces the dir. The served files are pinned + offline-capable and travel in a static export. To inject a single script, prefer provide_frontend!/register_component!; use this to serve the files that script (or a widget) then fetches / imports / <script src=>s from /ext-assets/<pkg>/….
SlateExtensionsBase.provide_frontend! Method
provide_frontend!(js; id="", esm=false, kind="")Declare a front-end <script> to be injected into the page whenever this package is active in a notebook — call it from your module's __init__. id dedups re-registration (a reload replaces the entry rather than stacking duplicates); omit it to key on the script's content. esm=true marks js an ES module. kind (non-empty) marks js a COMPONENT module: Slate wraps its export default and registers it under kind (see register_component!); "" ⇒ inject the script as-is (it self-registers). The general form behind register_widget! / register_component!. Live and in a static export; no boot cell, no ordering.
SlateExtensionsBase.provide_import! Method
provide_import!(spec, url) -> urlDeclare a browser ES-module import for every notebook that loads this package — the package-level counterpart of a notebook's @use. Front-end code the extension ships (a component module, a provide_frontend! script) can then import the bare spec both live and in an export, with nothing declared in the notebook.
Last-wins and idempotent, so it belongs in __init__ or the per-notebook __slate_frontend hook. A notebook's own @use of the same specifier WINS, so an author can always override the build.
A specifier declared here works in the session that loaded the package — the page extends its import map with any specifier it doesn't yet declare, the same way it injects a front-end script. So a using YourExtension in an open notebook makes import "spec" resolve without a reload. Re-pointing a specifier the page ALREADY declares is the one case that needs one, since a document can't redefine a specifier something may already have resolved.
Pin an exact version rather than a range: an export resolves the URL to bytes, and a moving target means two exports of the same notebook can ship different libraries.
provide_import!("mermaid", "https://esm.sh/mermaid@12.3.0")SlateExtensionsBase.provide_served_asset! Method
provide_served_asset!(bytes; mime="application/octet-stream") -> StringRegister bytes to be served by Slate at a stable, content-addressed, immutably-cacheable URL, and return that URL PATH (root-relative, e.g. /served/<hash>). Registering the same bytes again returns the same path (dedup). The bytes live in the worker; the hub fetches them lazily by hash and caches — so this is safe to call from a hot render path (it's just a Dict insert). Use for a large shared runtime a page loads once (a WASM blob, a JS bundle) rather than re-inlining it per output.
Live only — no export path
That URL is answered by the RUNNING hub, out of the LIVE worker's memory. A static export has neither, so a served URL 404s in an exported or published page — and unlike provide_assets! (page-local siblings for a site, data: for a standalone) nothing rewrites it.
This suits its intended user, a session-bound output (slate_live_render), which is re-rendered per browser connection and never replayed into a static page regardless. For bytes a SELF-CONTAINED output needs to keep after export, use provide_assets! instead.
Note also that this registry is filled at RENDER time, not at load time: unlike the __init__ / __slate_frontend registrations, it does not survive a worker restart until the cell that produced the bytes runs again.
SlateExtensionsBase.reconcile_bind Method
reconcile_bind(oldw::Widget, oldv, neww::Widget)The persistence policy when a bind cell re-runs: a changed widget kind always resets to the new default; otherwise keep the user's value unless the new widget's kind rejects it (per-kind reconciler, or keep-as-is for an unregistered kind).
SlateExtensionsBase.register_cell_action! Method
register_cell_action!(x)Register a per-cell toolbar button contributed by this package — call it from your module's __slate_frontend(slate_on) hook (where you also register editor extensions and RPC handlers). x is any to_cell_action-convertible value: a CellAction, or your own typed button. Slate injects a small script that calls the front-end seam window.slateRegisterCellAction, so the button appears in every cell's action strip (gated by the action's show), clicking it runs the action's onclick. Idempotent — deduped by the action's id (a re-run replaces rather than stacks duplicates), no boot cell. A cell action is an EDITING affordance: it shows in the live editor; a read-only static export renders no cell toolbar, so the button simply doesn't appear there.
SlateExtensionsBase.register_component! Method
register_component!(T::Type, js)
register_component!(kind::AbstractString, js)Auto-register a widget's front-end as a signals-based component module — the blessed authoring pattern. Prefer the type form: the kind is derived from T (SlateExtensionsBase.kind_for), so it's namespaced by your package and can't collide with another package's widget — and there's no kind string to keep in sync with to_widget. js is a module that just export defaults the component:
import { html, useSignal } from "@slate/widget";
export default ({ value, set, params }) => html`…`; // no kind string anywhereShip it as a file and read it with @pkg_asset so the JS lives in a real .js:
SlateExtensionsBase.to_widget(s::Stars) = Widget(Stars, s.default; max = s.max)
function __init__()
register_component!(Stars, @pkg_asset("assets/stars.js"))
endSlate injects <script type="module">, imports the module, and registers its default export under the kind; imports resolve against the page's import map (Preact/htm/signals + @slate/widget are served, offline-pinned). Live and in a static export. The string form takes an explicit (un-namespaced) kind — an escape hatch.
SlateExtensionsBase.register_fence_renderer! Method
register_fence_renderer!(lang, f)Claim markdown fenced code blocks tagged lang ($```lang$). f is called as f(source, info) — the block's body and its full info string — or as f(source) when that is all it accepts, and returns the VALUE the block should render as (displayed via slate_render, exactly like a value a cell returned), or nothing to decline and leave an ordinary code block.
Last-wins and idempotent, so it is safe from __init__ or from the per-notebook __slate_frontend hook, which runs every drain. lang matches case-insensitively.
register_fence_renderer!("mermaid", src -> MermaidDiagram(src))SlateExtensionsBase.register_kind! Method
register_kind!(kind; coerce, reconcile, wrap, domain)Register the value-lifecycle hooks for a control kind. Everything is optional — with none, Slate uses a type-driven default: it coerces the browser value to the type of the widget's default (see coerce_value, with error-fallback) and keeps the value across a re-run. So a typed widget often needs no call at all. Pass:
domain = w -> 0:w_max— a numeric range or allowed-value collection; Slate derivescoerce(coerce to the domain's type, then clamp/restrict into it) andreconcile(reset when out of domain).coerce/reconcile/wrap— raw closures, for a fully custom value lifecycle (e.g. a labeled option's index →Choice). An explicit hook wins overdomain.
register_kind!("stars"; domain = w -> 0:Int(get(w.params, "max", 5))) # bounds; or omit entirelySlateExtensionsBase.register_palette_command! Method
register_palette_command!(x)Register a ⌘K command-palette entry contributed by this package — call it from your module's __slate_frontend(slate_on) hook (where you also register cell actions, editor extensions and RPC handlers). x is any to_palette_command-convertible value: a PaletteCommand, or your own typed command. Slate injects a small script that calls the front-end global window.slateRegisterCommand, so the command appears in the palette alongside the built-ins, badged with your package name. Idempotent — deduped by the command's id (a re-run replaces rather than stacks duplicates), no boot cell.
A palette command is an EDITING affordance: it shows in the live editor. A read-only static export renders no palette, so the command simply doesn't appear there.
function __slate_frontend(slate_on)
provide_frontend!(@pkg_asset("assets/globe_tools.js"); id = "GlobeSlate.tools")
register_palette_command!(PaletteCommand("GlobeSlate.OpenPanel";
label = "Globe: open the layer panel", run = "window.globeSlateOpenPanel()"))
endSlateExtensionsBase.register_widget! Method
register_widget!(kind, js)Auto-register a CLASSIC-script front-end renderer for a widget kind — call it from your module's __init__; js should call window.slateRegisterWidget("<kind>", …). For the higher-level, signals- based component pattern, prefer register_component!.
SlateExtensionsBase.register_widget_js Method
register_widget_js(kind, js) -> WebPageA one-time front-end registration for a custom widget kind: wraps js (which should call window.slateRegisterWidget("<kind>", …)) in a WebPage so returning it from a cell installs the renderer. Put it in a cell above any @bind of that kind. This replaces the hand-rolled struct …; Base.show(MIME"text/html") … end boilerplate an extension would otherwise write.
register_widget_js("mathfield", read(joinpath(pkgdir(@__MODULE__), "assets", "mathfield.js"), String))SlateExtensionsBase.render_fence Function
render_fence(lang, source, info = lang) -> AnyThe value a $```lang$ block renders as — nothing when no extension claims lang, the renderer declines, or it throws. Containing a throw is deliberate: a broken extension degrades that one block to plain code instead of taking down the markdown cell around it.
Slate calls this in the WORKER, where extensions are loaded, while evaluating a markdown cell.
SlateExtensionsBase.replay_stack Method
replay_stack(slices) -> ArrayStack one slice per control value along a NEW trailing dimension, checking that they can travel as packed numeric data. Every slice must have the same shape — they become one array, and a page reads a slice by offset — so a ragged result is refused here rather than silently producing a misaligned page.
Widens an integer element type to Float64 unless it is one the packer handles natively: Int (i.e. Int64) is the common Julia case and is NOT packable, so it would otherwise fall through to JSON and quietly ship the slow representation.
SlateExtensionsBase.required_assets Method
required_assets(::Type{W}) -> js | nothingThe front-end a widget TYPE W needs — return its component module JS (typically @pkg_asset("assets/x.js")), or nothing (the default) for a type with no front-end. Slate calls this lazily, the first time a W is bound or displayed, and registers the module under kind_for(W):
SlateExtensionsBase.required_assets(::Type{Stars}) = @pkg_asset("assets/stars.js")So a package needs no __init__ — declaring the widget is pure dispatch (to_widget + required_assets), and only widgets a notebook actually uses load their JS. A type with no method contributes nothing, so this doubles as extension-detection.
SlateExtensionsBase.run_live_resets Method
Run every on_live_reset callback (isolated). Called by the worker before re-rendering live outputs.
SlateExtensionsBase.run_worker_resets Method
Run every on_worker_reset callback (isolated). Called by Slate when the namespace is re-established.
SlateExtensionsBase.served_asset Method
served_asset(hash) -> (; mime, bytes) | nothingLook up bytes registered by provide_served_asset! by content hash — the hub calls this (over the gate) to fetch a served asset the first time a browser requests it. nothing if unknown.
SlateExtensionsBase.slate_bind_names Method
slate_bind_names() -> Vector{Symbol}Every control the notebook declares, in name order (empty outside a cell).
SlateExtensionsBase.slate_bind_observable Method
slate_bind_observable(name) -> Observable | NothingA control's value as a live Observable, for a figure that should update IN PLACE rather than be rebuilt when the control moves.
The Observable is CELL-LOCAL — a fresh one per run, released when the cell re-runs — which is what makes an ordinary lift/map on top of it safe: it dies with the cell, so nothing accumulates across the re-renders a session-bound output does on every browser connect.
SlateExtensionsBase.slate_bind_value Method
slate_bind_value(name) -> AnyA control's CURRENT value, so a freshly built widget opens where the reader left it instead of snapping back to the declared default on every re-render. nothing if undeclared.
SlateExtensionsBase.slate_bind_widget Method
slate_bind_widget(name) -> Widget | NothingThe declared control behind a bound name — its kind, params and default — or nothing if the notebook declares no such control.
Use it to build an equivalent native control from the SAME declared domain, so the drawn widget and the Slate control cannot disagree about which values are legal.
SlateExtensionsBase.slate_context Method
slate_context() -> NamedTuple | NothingSlate's per-cell execution context, or nothing outside a Slate eval (e.g. local unit tests / a plain include). See the typed accessors below rather than reading fields directly.
SlateExtensionsBase.slate_effect Method
slate_effect(kind::Symbol; names = Symbol[], data...) -> nothingDeclare a cell EFFECT to Slate over the code→Slate channel — e.g. slate_effect(:everywhere; names = [:my_op]) asks Slate to re-establish those names on every region worker (the analogue of Distributed.@everywhere for process-global state a package registers). A no-op outside a Slate cell.
SlateExtensionsBase.slate_emit Method
slate_emit(channel, value) -> nothingPush value to the front end on channel (received by window.slateOnStream(channel, …)), routed through the current context's emitter — a worker PUBs on the gate stream, the in-process kernel pushes over SSE. A no-op outside a Slate cell, so package code can call it unconditionally.
SlateExtensionsBase.slate_everywhere Method
slate_everywhere(names::Symbol...) -> nothingSugar for slate_effect(:everywhere; names = names) — mark process-global state (a custom op, a global config) registered by the current statement so Slate re-establishes it on every worker.
SlateExtensionsBase.slate_live_render Method
slate_live_render(x) -> BoolWhether x is a SESSION-BOUND (live) output — one whose rendered content lives in a per-browser runtime session (e.g. a WGLMakie figure whose scene + interaction handlers run in a live Bonito session), rather than being fully self-contained in the captured HTML. Default false.
Slate uses this to know a cell's output must be RE-RENDERED for each browser page that connects (a reload, a second tab, a reconnect) instead of replaying the stored fragment — the same way a Bonito server serves a fresh session per page load. An extension opts a value in by adding a method:
SlateExtensionsBase.slate_live_render(::MyLiveThing) = trueSlateExtensionsBase.slate_notebook Method
The current notebook id ("" outside a cell).
SlateExtensionsBase.slate_off Method
slate_off(channel) -> nothingDrop the JS→Julia handler registered for channel — the symmetric counterpart to slate_on. Use it to remove a TRANSIENT per-cell handler (e.g. a Bonito session's inbox feed, keyed by its session id) on teardown so a re-run/close doesn't leak dead closures. A no-op outside a Slate cell.
SlateExtensionsBase.slate_on Method
slate_on(channel, f) -> nothingRegister a JS→Julia RPC handler for channel from PACKAGE code — the browser's window.slateCall(channel, payload) invokes f. Routed through the current cell's context (the notebook's __slate_handlers), so a package can wire an interactive widget's actions itself instead of the notebook hand-calling the injected slate_on. The symmetric counterpart to slate_emit (push) — slate_emit is Julia→JS, this is JS→Julia. A no-op outside a Slate cell.
SlateExtensionsBase.slate_on_bind Method
slate_on_bind(name, f) -> unregisterRun f(value) on every change of a control, and get back a thunk that removes the listener.
Dispatched INLINE by Slate, in the same turn the notebook global is assigned, and not cancellable — distinct from an @onchange body, which is spawned and superseded by a fresher change. That is the right split: propagating a value is a write that must not be dropped, while a user body may run long. Pair the returned thunk with slate_on_cleanup so a re-run does not stack listeners.
SlateExtensionsBase.slate_on_cleanup Method
slate_on_cleanup(f) -> nothingRegister a zero-arg callback f to run when the CURRENT cell is torn down — before it RE-EVALUATES, when it is DELETED, and before a namespace rebuild. Use it to release a live per-cell resource a package sets up during eval — a Bonito Session, a subscription, a spawned task — so a re-run or a delete doesn't leak it. The callback runs LATER, possibly outside any cell eval (a delete fires it off a worker teardown call), so it must be self-contained — close over the resource and any captured emit/off it needs, not slate_context (which is unset then). A no-op outside a Slate cell.
SlateExtensionsBase.slate_region Method
slate_region() -> Symbol | NothingThe region this eval runs on (nothing = the main side).
SlateExtensionsBase.slate_regions Method
slate_regions() -> Vector{Symbol}Regions declared for the current cell (empty outside a cell or when none are declared).
SlateExtensionsBase.slate_render Method
slate_render(x) -> Dict | SlateHtml | NothingAn extension's rich-output hook: return a component descriptor, an html_fragment, or nothing (the default — x isn't Slate-renderable). Its presence is the detection: showable reports the Slate MIME iff a non-nothing method exists, so Slate's display capture picks it over text/html / text/plain.
SlateExtensionsBase.slate_save_asset Method
slate_save_asset(name, data; mime = "", dtype = nothing) -> Union{String,Nothing}Save data as an asset of the cell running now and return its page path, for Slate.asset(path) in the browser. Call it from a slate_render or show method to put BULK DATA beside your markup instead of inside it: the bytes go to Slate's content-addressed store, so they ride the cell's memo, are served with an immutable cache header, and are inlined into a static export — a figure's coordinates then cost one cached fetch rather than megabytes of JSON in every /state response.
data is a byte vector, a string, or a numeric array (which travels column-major with its shape and dtype, readable as a typed array). dtype narrows an array before storing.
Returns nothing where Slate keeps no assets for the caller — outside a cell eval, and on paths that install the context but harvest nothing, such as a slate_on handler or a task your render spawned (task_local_storage does not reach a child task). Treat that as "send it another way" and fall back to inlining; a path is never returned unless it will resolve.
SlateExtensionsBase.slate_side Method
The current side as a string ("" = main); "" outside a cell.
SlateExtensionsBase.to_cell_action Method
to_cell_action(x) -> CellActionTurn x into a CellAction. register_cell_action! calls this, so — exactly like to_widget for a @bind control — an extension defines its own type and overloads to_cell_action for a typed, documented button (with auto_cell_action for the common reflect-the-struct case):
Base.@kwdef struct InsertSnippetButton
icon::String = "➕"
title::String = "insert a snippet"
show::String = "cell.kind === 'code'"
onclick::String = "window.myExtInsert(cellId)" # a helper this extension shipped
end
SlateExtensionsBase.to_cell_action(a::InsertSnippetButton) = auto_cell_action(a)The identity method means an existing CellAction passes through unchanged.
SlateExtensionsBase.to_palette_command Method
to_palette_command(x) -> PaletteCommandTurn x into a PaletteCommand. register_palette_command! calls this, so — exactly like to_cell_action for a toolbar button — an extension defines its own type and overloads to_palette_command for a typed, documented command (with auto_palette_command for the common reflect-the-struct case):
Base.@kwdef struct OpenGlobePanel
label::String = "Globe: open the layer panel"
run::String = "window.globeSlateOpenPanel()"
end
SlateExtensionsBase.to_palette_command(c::OpenGlobePanel) = auto_palette_command(c)The identity method means an existing PaletteCommand passes through unchanged.
SlateExtensionsBase.to_widget Method
to_widget(x) -> WidgetTurn x into a Widget. @bind name x calls this, so an extension can define its own type and overload to_widget to get a typed, documented constructor (instead of a bare Widget("kind", …)):
struct Mathfield; label::String; end
SlateExtensionsBase.to_widget(m::Mathfield) = Widget("mathfield", ""; label = m.label)The identity method means an existing Widget (or a built-in constructor's result) passes through unchanged.
SlateExtensionsBase.widget_kinds Method
Registered control kinds (built-ins once core is wired on, plus any extension kinds).
SlateExtensionsBase.with_render_memo Method
with_render_memo(f)Run f, and make slate_render run ONE time for each value that f shows through a Slate MIME.
Slate's display capture wraps the showable + show calls of one value in this. The memo is task-local, so parallel cells do not share it, and finally always clears it — a value that is shown again, or is changed between two displays, gets a fresh render.
This is host plumbing. An extension defines slate_render and never calls this.
SlateExtensionsBase.wrap_value Method
wrap_value(w::Widget, v)The registry value → the user-facing value (e.g. a Choice for a labeled option). Identity for an unregistered kind.
SlateExtensionsBase.@ext_asset_url Macro
@ext_asset_url(sub = "") -> Stringext_asset_url for the CALLING package — the key is derived from the enclosing module, so a package builds its served-asset URLs with just the subpath, no key at all:
@ext_asset_url("echarts-gl/echarts-gl.min.js") # "/ext-assets/GlobeSlate/echarts-gl/echarts-gl.min.js"SlateExtensionsBase.@pkg_asset Macro
@pkg_asset(path) -> PkgAssetRead a file bundled in the CALLING package, resolved relative to its package root (pkgdir). The result is a string (PkgAsset) that also carries the file's path, so a front-end registered from it follows edits to the file: register_component!(Stars, @pkg_asset("assets/stars.js")).
SlateExtensionsBase.@pkg_dir Macro
@pkg_dir(path) -> StringAbsolute path to a directory bundled in the CALLING package, resolved against its package root (pkgdir) — the directory analogue of @pkg_asset. For declaring a vendored asset tree: provide_assets!("GlobeSlate", @pkg_dir("assets/echarts-gl")).
SlateExtensionsBase.@provide_assets! Macro
@provide_assets!(dir) -> Stringprovide_assets! for the CALLING package — the key is derived from the enclosing module (pkg_key), so there's no @__MODULE__ to write and no string to keep in sync. Pair it with @pkg_dir (or an Artifacts/Scratch dir):
@provide_assets!(@pkg_dir("assets"))The notebook API
The helpers you call from inside a cell — slate_table, echart, animate, @bind, @replay, save_asset and the rest — are public, and their guide pages are Charts, Tables, Widgets, Animation, Live Updates and Offline Interactivity.
Their docstrings are rendered below under Report engine, because that is the module they live in. Everything else in that section, and the sections after it, is internal: the serving and rendering layers, listed for contributors and the curious.
Sweeps and compute targets
A sweep runs a cell's body over a parameter grid, on this machine or on a cluster's scheduler. The guide is Clusters.
KaimonSlate.ReportEngine.Sweep.@sweep Macro
@sweep grid [target] [setup=…] [chunk=…] do p
…
endRun the body once per row of grid, as batch work, and return a [ShardedResult].
Belongs in a #%% job cell, and takes NO target there:
#%% job id=scan cluster=hpc walltime=04:00:00
scan = @sweep(paramgrid(n = 1:64)) do p
simulate(p.n)
endThe header is where the target and the resources live. cluster=hpc is a NAME, resolved by each machine against its own registry — which is what lets one notebook run against a laptop's test cluster and a site's real one with nothing edited in a cell. walltime=, chunk= and data= sit beside it, and the ⚙ on the cell edits all of them without touching Julia source. That ⚙ is offered on a job cell and nowhere else.
In an ordinary code cell this still runs, and is a worse version of the same thing: the target must be written into the body, the header settings have nowhere to live, and nothing can be changed except by editing code. Passing target is for a STANDALONE SCRIPT — a .jl run outside Slate, where there is no header to read and no card to ask from. That is also the only place submit=true belongs; in a notebook the work starts when someone presses Submit.
The body travels as SOURCE, so it must be self-contained apart from:
plain data from the notebook, which is captured and serialized automatically;
using/import, written in the body and lifted out to run once per chunk; andfunctions, macros and types the NOTEBOOK defines — the cell that defined one is found and its source travels with the sweep, transitively, so an ordinary helper cell just works:
# one cell stress(p) = p.β^2 / (1 + p.β) # another @sweep(paramgrid(β = 0:0.1:2), hpc) do p using MyPkg MyPkg.simulate(stress(p)) endEditing that helper re-keys the sweep, exactly as editing the body does — it is part of what computed the results, so it is part of their identity.
setup = begin … endstill takes definitions written out by hand, which is what something with no cell behind it needs.
Re-running the cell is a reconcile: whatever has landed is kept, only what is missing is submitted. Editing the body makes it a different sweep.
labels = :chapter (or a list of names) marks fields of the parameter rows as display only. They stay in r.params, the results and the card, and are removed before a unit is keyed and shipped, so changing a label keeps every result and the body never sees it.
KaimonSlate.ReportEngine.Sweep.paramgrid Function
paramgrid(; kw...) -> Vector{NamedTuple}The cartesian product of the named axes, in column-major order (first axis varies fastest).
paramgrid(β = 0.1:0.1:2.0, seed = 1:100) # 2000 pointsAdding a point later changes only that point's key, so the shards you already have are untouched.
A grid from explicit rows, for a parameter set that is not a product.
KaimonSlate.ReportEngine.Sweep.list Function
list(; cluster = "") -> Vector{NamedTuple}
list(target) -> Vector{NamedTuple}The sweeps a store holds, newest first: (; run, sweep, created, cell, notebook, docid, units, ok, failed, missing, state, body). sweep is the digest of the body, setup and captures, so two runs with the same sweep computed the same thing over different grids. notebook is the notebook's name when the run was written and docid the id that identifies it. state is read from the store alone: :succeeded, :partial (finished with failures), :cancelled, :exhausted (every unfinished chunk has used its attempts), :unfinished (started, not done) or :ready (never started). Sweep.reopen(row.run) gives the result.
KaimonSlate.ReportEngine.Sweep.reopen Function
reopen(run; cluster = "", plot = nothing) -> ShardedResult
reopen(target, run; plot = nothing) -> ShardedResultA sweep from its store, by run id (r.run, or a prefix naming one run, as Sweep.list shows it). The parameters come from the store's own descriptors, with any labels the sweep was given, so r.results, r.dataset, r.errors and the card work as they do on the cell that ran it. The card's controls act on the stored sweep. plot is the card's chart, as @sweep(plot =) takes it.
KaimonSlate.ReportEngine.Sweep.SweepTarget Type
SweepTargetWhere a sweep's units run and how the hub and the workers see its store: LocalTarget on this machine, ClusterTarget through a scheduler or on a host Slate drives itself. A job cell names one with cluster=, and run_sweep runs a grid on it.
KaimonSlate.ReportEngine.Sweep.LocalTarget Type
LocalTarget(; root, chunk = 8, procs = …, threads = "auto,1")Run shards as local subprocesses. The default when there is no cluster, and the same cells work against it. threads is each task process's --threads.
KaimonSlate.ReportEngine.Sweep.ClusterTarget Type
ClusterTarget(host; kind, root, root_remote, project, payload, resources, chunk)Submit shards to a batch scheduler through host (a login node in ~/.ssh/config; "" runs the client tools locally, which is the case when Slate itself runs on a login node). SlurmTarget and PbsTarget are this with kind already chosen.
root is the store as the HUB sees it and root_remote as a COMPUTE NODE sees it. They are the same store; on a real cluster they are the same path, and they differ only when something is mounted differently on the two sides.
Which scheduler is a property of the CLUSTER, not of a second kind of target: everything below — the store, provisioning, the environment key, how a sweep is planned — is identical either way, and only launcher_for differs. A second struct would have duplicated twenty methods to change one.
KaimonSlate.ReportEngine.Sweep.SlurmTarget Function
A ClusterTarget on SLURM. The spelling notebooks and the docs use.
KaimonSlate.ReportEngine.Sweep.PbsTarget Function
A ClusterTarget on PBS.
Notebook server
The HTTP/WebSocket serving layer, live-notebook state, history, and agent integration.
KaimonSlate.NotebookServer Module
NotebookServerThe live, interactive notebook backend (interactivity layer 1). Holds a notebook bound to a .jl file and serves a browser SPA plus a small JSON API. Editing a cell reconciles → reactively recomputes only stale cells → persists back to the .jl (so the agent and the browser share one source). Runs CLI-side, wrapping the engine (ReportEngine) and per-cell renderer (ReportRender).
KaimonSlate.NotebookServer.PERMISSION_TIMEOUT Constant
How long a tool call waits for someone to allow it.
Much shorter than ASK_TIMEOUT. That one is a specialist asking a question and then getting on with its turn; this one HOLDS a tool call open, so the agent is stalled for the whole wait and whatever it was doing is stalled with it. Long enough to answer a prompt you can see, short enough that walking away ends the call rather than parking it.
KaimonSlate.NotebookServer._ACP_MODEL_SOURCES Constant
Per-agent model enumeration: the ACP agent name, the executable that has to be on PATH, and how to list its models.
list returns bare ids; an empty id selects the agent's configured default model. _acp_models adds the acp:<agent>[:<model>] prefix. Agents differ in whether they can be asked: opencode prints its catalogue, while claude-agent-acp only offers a list inside a live session, so its ids are named here. agent must match Kaimon's ACP_AGENTS.
The claude ids are the value fields of the model entry in that agent's configOptions, and nothing else is accepted — default is its name for the most capable model, not a placeholder to be replaced with opus.
KaimonSlate.NotebookServer._CHECKS Constant
The last thing the checker said about a notebook, newest first.
KaimonSlate.NotebookServer._SWEEP_IDLE_STOP Constant
How long a task worker stays up with nothing queued for it, in seconds.
KaimonSlate.NotebookServer.CloudflarePagesTarget Type
Deploy to a Cloudflare Pages project via wrangler pages deploy (token = CLOUDFLARE_API_TOKEN).
KaimonSlate.NotebookServer.EchartsDoc Type
One documented ECharts option path: path (e.g. yAxis.type) and a markdown doc (meaning + values/default + the Slate DSL form).
KaimonSlate.NotebookServer.GithubPagesTarget Type
Deploy to a repo's gh-pages-style branch via [publish_site] (gh + Actions Pages deploy).
KaimonSlate.NotebookServer.NetlifyTarget Type
Deploy to a Netlify site via netlify deploy --prod (token = NETLIFY_AUTH_TOKEN).
KaimonSlate.NotebookServer.NotebookNeedsUpdate Type
A notebook file that must be updated to the current format before it opens.
KaimonSlate.NotebookServer.ParCell Type
Minimal per-cell info the scheduler needs (built from a Cell's deps/reads/writes/flags).
KaimonSlate.NotebookServer.PublishResult Type
The outcome of deploying one document to one target — the raw material for a ledger Event.
KaimonSlate.NotebookServer.PublishTarget Type
A deploy adapter. Implement publish(::T, nb; …)::PublishResult and preflight(::T)::NamedTuple.
KaimonSlate.NotebookServer.RegionWaiting Type
RegionWaiting(why, host, region)A region cell cannot run YET, and nothing is wrong. Thrown where the wait is discovered (under nb.lock, which must never block), caught where the cell's state is set, and turned into BLOCKED rather than ERRORED.
A distinct TYPE rather than a message match: the same call path also raises genuine failures — a region that is not defined, a worker that could not start — and telling them apart by reading the text would go wrong the first time someone rewords one.
why is a code, host is the machine it is about and region the region waited for. None is written for a reader: the page words the wait, beside the chip that shows it.
KaimonSlate.NotebookServer.SlateApiEntry Type
One documented Slate helper.
summary + keywords drive the cheap INDEX surfaces (the slate.api table of contents and the cheatsheet inlined in the agent prompt); signature + doc (or docbinding) drive the full per-helper detail. The split is deliberate: an index line says a helper EXISTS and what it is for, and is lossy on purpose so an agent drills in rather than guessing from a summary.
keywords are ROUTING terms — the words someone would search for who doesn't know the helper's name ("log axis" → echart, "clickable row" → TableSelect). They need not appear in the docs.
KaimonSlate.NotebookServer.Specialist Type
Specialist(name; brief, verbs, briefing, permission)One kind of specialist.
name is the crew label — it lanes the agent in the chat, keys its state, and is how everything else refers to it. brief is the standing instruction it is spawned with. verbs are the BARE tool names it may call; the namespace is applied at summon time, because this checkout serves as slate_dbg and an installed one as slate, so a written-down tool name is right in exactly one of them. briefing(nb, subject, task) -> String builds the opening turn from live context — the part that makes a specialist start oriented rather than surveying. permission should be a preset with no allowances of its own — specialist, which is also the only one that denies the CLI's own shell and file tools. A preset that allows anything is UNIONED with verbs on the Claude Code path, which widens the allowlist and undoes the narrowness that is the whole reason for the role.
KaimonSlate.NotebookServer.ZenodoClient Type
HTTP operations for the Zenodo deposition API, as an interface so tests can inject a fake.
KaimonSlate.NotebookServer.ZenodoHttp Type
Real Zenodo client. sandbox=true targets sandbox.zenodo.org for dry runs.
KaimonSlate.NotebookServer.ZenodoTarget Type
Archive a document to Zenodo as a versioned, citable DOI.
KaimonSlate.NotebookServer._apply_pending_revise! Method
Apply any pending revision. Called before routing, so it lands between requests rather than inside one. Costs an atomic read when nothing changed.
KaimonSlate.NotebookServer._await_or_promote! Method
Wait up to grace seconds for job: finished → its result (and forget it); else mark it promoted, so its caller is told when it finishes, and return nothing.
KaimonSlate.NotebookServer._bib_origin Method
The site of a bibliography address: its scheme and host.
KaimonSlate.NotebookServer._broadcast_debug Method
Push the session to every open page.
The debugger has more than one driver: a reader clicking Next, and — once the debugging agent lands — a specialist stepping on its own. A surface that only updated in response to its own clicks would show nothing at all while something else drove, so every verb pushes, and the browser applies what it is told rather than what it asked for.
KaimonSlate.NotebookServer._build_from_request Method
The publish panel's options as posted by the client → a manifest build record.
KaimonSlate.NotebookServer._build_kwargs Method
A recorded manifest build → the kwargs every build path hands export_to_site.
KaimonSlate.NotebookServer._caller_notified Method
Whether the agent whose tool call is running will be told when its job finishes.
KaimonSlate.NotebookServer._capture Method
Run a command for its stdout, giving up after secs rather than blocking a request handler.
KaimonSlate.NotebookServer._cell_source Method
The source of the cell a frame's pseudo-file names, or nothing when it isn't one.
KaimonSlate.NotebookServer._checker_task Method
What changed since it last looked — the whole of what it is asked to review.
KaimonSlate.NotebookServer._cite_labels Method
_cite_labels(style, entries, numbers) -> (; labels, names, tags, open, close, authordate)How a style labels each entry in running text, and the brackets a group goes in: a number for a numeric style ([1; 3]), the surname and year for author-year-brackets ([Sun 2026; Elder 2025], with a, b, … where two entries would share a label, in order of first citation as Typst assigns them), and otherwise author and year ((Sun et al., 2026)). numbers is the first-citation order (citation_numbers).
names (the authors as cited, Sun et al.) and tags (what follows them: the year, or the number) are the two halves the prose form puts apart, Sun et al. (2026) (see _cite_text). A work with no author is named by its title, as the styles do: (Water levels, 2026).
KaimonSlate.NotebookServer._cite_text Method
_cite_text(fmt, cites, form; wrap = (key, text) -> text) -> StringA citation group as running text in the style fmt (_cite_labels). A bracket's group goes in the style's brackets, (Sun et al., 2026; Elder, 2025) or [3, p. 7; 5], and in an author-date style an author's works one after another are named once, (Ning et al., 2024, 2025). The prose form (form "p") names the authors in the sentence, Sun et al. (2026) or Sun et al. [3]. wrap(key, text) makes each key's part of the text what it is in the output (a link, escaped).
KaimonSlate.NotebookServer._clusters_json Method
This machine's named compute targets for the browser — a job cell's cluster= picker.
KaimonSlate.NotebookServer._collect_hint Method
How a promoted job's result is collected, for the reply that hands back its id.
KaimonSlate.NotebookServer._debug_json Method
Shape a DebugState for the browser.
source/srcfirst are whatever the kernel could give; when the frame is a cell's own code the kernel sends nothing and the notebook's copy goes in here instead, starting at line 1. side/where say which machine this is happening on — the answer is never implied by the notebook, because a single notebook can be stepping code on a compute node while the rest of it runs locally.
KaimonSlate.NotebookServer._doc_markdown Method
_doc_markdown(ctx, c) -> (markdown, native)A markdown cell as Documenter-flavoured markdown, with its values written in as text. native is false when the cell has something plain markdown cannot carry — a rich or failed interpolation, an extension-rendered fence, a local image, a citation or figure reference, a @replay-driven value — in which case a docs page embeds the rendered cell instead.
KaimonSlate.NotebookServer._doc_spliced Method
_doc_spliced(c) -> (markdown, native)A markdown cell's source with its values written in as text: a scalar's text, a markdown value's markdown, a fence's code block when nothing claimed it. native is false when a value is something plain markdown cannot carry (a rich or failed interpolation, an extension-rendered fence).
KaimonSlate.NotebookServer._drive_region_sweeps! Method
_drive_region_sweeps!(h)One pass over every region with a store for sweeps: read its queue, and start, feed or stop its task worker to match. Runs on the supervisor's tick, one pass per region at a time (_region_work!).
KaimonSlate.NotebookServer._env_preparing Method
Whether region name is being prepared for nb's environment, or will be once the prepare running there ends.
KaimonSlate.NotebookServer._force_cell! Method
_force_cell!(nb, id) -> BoolMark cell id to run as its ▶ does, under nb.lock: it runs whatever the memo holds, and its dependents restale and run after it. Already running, it is left alone (the run in flight is the answer) and this returns false.
KaimonSlate.NotebookServer._http_get_catalog Method
GET the catalog, honouring etag. Returns (:notmodified | Vector | nothing, error_message).
KaimonSlate.NotebookServer._idents Method
The identifiers in a snippet, in the order they appear, without duplicates.
KaimonSlate.NotebookServer._inscope_modules Method
The package/module names in scope for nb: its project deps ∪ the packages its cells using, plus the universal Base/Core. Drives module-scoped doc search so the SHARED index only surfaces THIS notebook's packages, not another notebook's. Error-tolerant — a failure yields the universals.
KaimonSlate.NotebookServer._installed_extension_registry Method
The extension registry among the reachable registries, or nothing if it isn't installed. Matched on NAME or on repo url — a registry cloned under a different name is still the same one.
KaimonSlate.NotebookServer._is_older Method
_is_older(installed, latest) -> BoolIs installed a strictly earlier release than latest? Both are version strings that may be empty or non-semver (a dev checkout reports no version at all). Anything that doesn't parse as a pair of version numbers is NOT reported as out of date: offering to "update" a local dev checkout to a registry release would quietly replace the user's working copy.
KaimonSlate.NotebookServer._kernel_alerts Method
_kernel_alerts(side, hist; now = time(), quiet_cells = String[]) -> VectorThe watchdog's alerts for one kernel from its telemetry history (oldest first). quiet_cells are the code cells that sample says are running, checked for no activity. Each alert is (; kind, sev, scope, target, since, detail), sev one of "crit", "warn", "info".
KaimonSlate.NotebookServer._live_source Method
Resolve a live watch to the Julia it should run: literal text, or the named cell's source.
KaimonSlate.NotebookServer._live_status Method
How a live watch's run turned out: ok, unavailable, or error.
unavailable is what a watch looks like from a frame where its names do not exist, which happens constantly while stepping and is not worth a red box. Julia reports exactly that as an UndefVarError, so it is separable from a genuine mistake in the expression.
KaimonSlate.NotebookServer._localize_imports Function
Localize an import map for an export. :cdn passes remote urls through; the offline modes resolve each one to bytes and REWRITE the whole module graph, because a CDN commonly answers with a stub that re-exports by relative path — inlining just the entry file yields a page that silently loads nothing.
An import that can't be closed is an ERROR in an offline mode, not a warning: the export was asked to stand alone, and quietly emitting a network-dependent page defers the failure to whoever opens it, possibly years later.
:inline returns the entry specifiers PLUS one synthetic @slate-mod/… entry per module of the graph (see _import_mod_spec); :sibling puts the modules in files and returns page-relative paths.
KaimonSlate.NotebookServer._notice_if_finished Method
Tell a promoted job's caller that it finished, once. A job that finished within its grace window was returned in the tool call itself and gets no notice; a collected one is gone.
KaimonSlate.NotebookServer._page_orchestrator Method
Hand the orchestrator a blocked question as a turn — the push that makes this agent-to-agent.
KaimonSlate.NotebookServer._parse_catalog Method
Validate and unwrap a catalog document. nothing when it isn't one — a 404 HTML page reaching the cache would otherwise poison the gallery until the TTL expired.
KaimonSlate.NotebookServer._peer_is_owner Method
_peer_is_owner(stream) -> BoolWhether the account at the far end of this request's connection is the one running the hub. True for non-loopback peers and off Linux; false when the owner cannot be established, since a check that cannot answer must not let the request through.
KaimonSlate.NotebookServer._permission_ask Method
Answer Kaimon's question about one tool call: :allow, or anything else to refuse.
Registered with Kaimon.set_permission_ask! at startup. Kaimon has no notebooks and no roles, so it asks every time and this decides whether a person needs to see it.
KaimonSlate.NotebookServer._prepare_for_notebook! Method
_prepare_for_notebook!(nb, name; rebuild_sysimage = false)Prepare region name for nb's project, keeping the node it gets for the worker that follows, then re-run the cells that were waiting. Background; progress is read from /api/regions/prepare. A prepare asked for elsewhere that names an open notebook comes here too, so the node it waited for goes to that notebook instead of back to the scheduler.
KaimonSlate.NotebookServer._prior_findings Method
What has already been concluded about this cell and the cells feeding it.
Findings were recorded and then never handed to anybody. A specialist investigated a notebook where the cause had already been found, reviewed and fixed, and worked it out again from nothing — because nothing told it that had happened.
Scoped to the subject's own dependency cone: a finding about an unrelated corner of the notebook is someone else's answer to someone else's question, and pasting all of them in would bury the one that matters.
KaimonSlate.NotebookServer._recorded_build Method
This notebook's build record in site's manifest, or nothing if the site doesn't know it yet.
KaimonSlate.NotebookServer._register_permission_ask! Method
Hand Kaimon the prompt it should use before refusing a tool call.
Kaimon is not a dependency — it loads this package as an extension, so it is reached through Main the way _agent_call does. An older Kaimon without the hook keeps refusing outright, which is the behaviour this replaces, so a missing function is not an error.
KaimonSlate.NotebookServer._release_region! Method
_release_region!(h, r) -> (; ok, left, told)Release the allocation of region r on request from a page or an agent. ok says whether the scheduler confirmed the release; when it did not, left is what it lists under the job name afterwards (nothing when it could not be asked). told is the task that tells the pages, or nothing without a hub.
The request is gone when the release succeeds or the scheduler lists nothing, and the cells waiting in its queue then wait for a run in every notebook that uses the region. A withdrawal can arrive before the placement task has submitted the job, so the withdrawal stamp tells that task to release whatever it submits. The stamp is set again once the cells have stopped waiting, so a task the supervisor started for them during the release counts as withdrawn too. When the scheduler still lists the job, the request stands: the stamp is undone and the task in flight keeps serving it.
KaimonSlate.NotebookServer._resolve_asset_urls! Method
_resolve_asset_urls!(entries) -> entriesMake every image/video reference absolute, resolved against the catalog's own URL.
The build mirrors card imagery into the published artifact and records it as an artifact-relative path (assets/StarRating/ab12cd.png) so the gallery loads everything from one origin. Left as-is, the browser would resolve that against the NOTEBOOK's origin and 404. Entries that already carry an absolute URL (an author hot-linking a CDN, or an asset too big to mirror) pass through untouched.
KaimonSlate.NotebookServer._run_bg Method
_run_bg(work, nb, label; grace) -> (; done, jobid, text)Race a blocking piece of agent work against grace seconds: finished in time → its result; still going → a job id, with work continuing in the background (poll slate.check_eval).
Same machinery and registry as agent_scratch_eval_bg!, for the same reason: an agent must not be held open — or cut off by a transport idle timeout — by a cell that turns out to be slow, and it cannot reliably predict which cells those are. grace <= 0 promotes immediately. label's first word names the tool ("run", "add_cell", …).
Note this races the RUN, not the structural edit: callers commit the cell (so its id and existence are certain) and pass only the wait-and-format step here.
KaimonSlate.NotebookServer._schedule_checker! Method
Wait for the notebook to stop changing, then review it. One waiter per notebook.
KaimonSlate.NotebookServer._session_hosts Function
_session_hosts(nb = nothing) -> Dict{String,Vector{String}}The hosts there is something to sign in to, each with what it is used for. Machine-wide for nothing (the home page); given a notebook, only the hosts it names — a notebook that sweeps on one cluster has no business showing a control for another.
KaimonSlate.NotebookServer._specialist_cell_context Method
The subject cell and where its inputs come from, so a specialist starts oriented.
Not _cell_context (server_export.jl), which builds the same idea for a CHAT turn: that one opens by explaining that the user clicked ✨ and tells the agent which of slate_read/slate_view to reach for, and a specialist has neither. Same question, different reader.
KaimonSlate.NotebookServer._stale_note Method
What a run=false write left behind, for its return string.
An agent that never sees its debt doesn't pay it: run=false returns before anything evaluates, so this string is the only place the outstanding work can surface. Report the whole stale set (the edit's cascade plus anything already outstanding), not just the cell touched — the point is the running total, which is what a caller deciding "reconcile now or keep editing" actually needs.
KaimonSlate.NotebookServer._start_job Method
_start_job(work, nb, kind, errprefix) -> ScratchJobRegister a job and start work() on a background task. Its result (or errprefix plus the error) is kept for scratch_check. The caller is captured here, in the tool call's task: spawned tasks don't inherit task-local storage.
KaimonSlate.NotebookServer._start_queued_prepares! Method
_start_queued_prepares!()Start the next queued prepare of each region whose prepare has ended. Called as a prepare ends and from the supervisor, so a queue behind a prepare started elsewhere (the Regions manager, a tool) moves too.
KaimonSlate.NotebookServer._start_region_worker! Method
_start_region_worker!(nb, name)Start this notebook's worker on region name without running a cell: from the worker panel. A region that needs a node first queues for one, as a cell's run does, and the worker starts when the node is granted or the host is signed in to (_region_ready!).
KaimonSlate.NotebookServer._start_revise! Method
Load Revise (if it's reachable) and start the file-change watcher. No-op for an app or a depot install. Best-effort throughout: a hub that cannot revise must still serve.
KaimonSlate.NotebookServer._status_alive Method
Is this worker running? The evidence differs by KIND, and asking the wrong question is worse than not asking: proc_up reads a LOCAL process handle, which a remote worker does not have, so a remote worker judged that way reports "not running" on a card that is simultaneously showing its live CPU and memory. An operator page that contradicts itself is worse than one that says less.
A remote worker's evidence is its wire, or failing that a sample recent enough to have come from a live process. A local one is a process we own, so ask the OS — a process that has exited is not running however recently it spoke.
KaimonSlate.NotebookServer._stop_watchers! Method
Stop a notebook's file/@asset watchers, heartbeat and periodic history snapshot. Teardown only.
KaimonSlate.NotebookServer._table_title Method
A table's caption (slate_table(…; title=…)), or nothing. Shared by every fixed exporter.
KaimonSlate.NotebookServer._userprog_note Method
What the notebook's cells last reported through slate_progress, as a short suffix (or "").
Once a run is PROMOTED the caller is no longer on the other end of a gate request, so in-run progress has nowhere to stream to — the poll is where it can still reach them. Without this a poll can only say how long it's been, which doesn't distinguish "70% through" from "wedged".
KaimonSlate.NotebookServer._verdict_task Method
The claim, the notebook, and nothing else.
The specialist's reasoning is deliberately absent. Handed the argument, a reviewer reviews the argument and agrees with it; handed the conclusion, it has to go and look. The second is the only one worth paying for.
KaimonSlate.NotebookServer._wrap_frame_scope Method
Bind the paused frame's locals around src, so a watch written against them resolves.
Only the NAMES appear in the generated source: a value has no source form, so it arrives at run time through the dict the kernel published. Notebook globals still resolve; a local of the same name shadows one, which is the scoping a reader expects from the line they are stopped on.
With no frame — no session, or a finished one — this is the identity, and the watch falls back to namespace scope rather than failing. A chart over accumulated results is still worth seeing after the run ends.
KaimonSlate.NotebookServer._zenodo_deposit Method
_zenodo_deposit(client, depositionId, file, metadata) -> PublishResultThe four-step deposition flow over an already-written bundle file and a ready metadata block: create (or new-version from depositionId) → upload to the bucket → set metadata → publish. Returns a PublishResult carrying the minted doi and the new depositionId in meta. Notebook-free, so the orchestration is unit-testable with a fake ZenodoClient.
KaimonSlate.NotebookServer.adopt_findings! Method
Take on findings that arrived in an opened file.
Merged by id rather than replacing: the file's records are what its sender established, and a notebook opened here may have its own. A record already known is left alone — the local one has this machine's decision on it, and an incoming copy would be a step backwards.
KaimonSlate.NotebookServer.agent_delete_cell! Method
Delete a cell.
KaimonSlate.NotebookServer.agent_rename_cell! Method
Rename a cell's id (its label). Ids must be unique + #%%-header-safe; returns a status string.
KaimonSlate.NotebookServer.agent_run! Function
Run one cell (or recompute all stale if id empty); return the result(s).
KaimonSlate.NotebookServer.agent_scratch_eval_bg! Method
agent_scratch_eval_bg!(nb, source; ephemeral=false, grace=_scratch_grace(), memo_*…)
-> (; done::Bool, jobid::String, text::String)Non-blocking scratch eval. Runs agent_scratch_eval! on a background task and races it against grace seconds: finishes in time → (done=true, text=<result>); still running → (done=false, jobid=<id>, text=<hint>), the eval continuing on the worker (poll slate.check_eval). The tool call thus never blocks past grace, so it can't hit the session-tool timeout.
KaimonSlate.NotebookServer.agent_surface_controls! Method
agent_surface_controls!(nb, id, controls; caller="")Surface @bind controls onto cell id's control strip — the agent-facing form of drag-to-host. Presentation only (rewrites the .jl, no re-eval). controls uses the header layout grammar: a,b,c = a row of single controls; [a,b],c = a stacked column [a,b] then a column c; "" clears the strip. Names must be @bind variables defined somewhere in the notebook (validated, so a typo is rejected with the available names rather than silently dropped).
KaimonSlate.NotebookServer.answer_ask! Method
Answer a pending request. The ask is dropped HERE, by the answerer, not in the waiter's finally: otherwise the two race, and the reply to whoever answered could still list the request they just dismissed — arriving after the broadcast that cleared it, so the prompt reappears and sticks.
KaimonSlate.NotebookServer.app_defaults Method
app_defaults(; theme, fullwidth, pagewidth, figwidth, scrollzoom, wrapoutput) -> Dict{String,Any}The presentation an app's visitor gets before expressing a preference of their own. Pass the result as appdefaults to export_app or start_server.
These are defaults, not enforcement: a visitor who has chosen keeps their choice, because the app's settings popover offers the same reader-facing subset and localStorage still wins.
theme— a Slate palette name ("daylight","midnight","nord", …)fullwidth—truespans the window instead of a constrained reading columnpagewidth/figwidth— px: the reading column, and a cap on rendered figuresscrollzoom— percent;0means the wheel never zooms a chartwrapoutput—truewraps wide text output instead of scrolling it
An unrecognised name is dropped rather than guessed at, so a typo silently has no effect rather than being applied to the wrong setting.
export_app(nb, "dist/myapp"; appdefaults = app_defaults(theme = "midnight", pagewidth = 1400))KaimonSlate.NotebookServer.archive_target_names Method
Names of the configured targets that are ARCHIVES (see _ARCHIVE_KINDS), from the live ledger.
KaimonSlate.NotebookServer.ask_and_wait Method
ask_and_wait(nb, role, kind, from, text; timeout) -> StringPost a request and block until someone answers. A timeout answers on their behalf, so a specialist is never wedged forever on an empty room; for consent that answer is NO, because silence is not permission.
KaimonSlate.NotebookServer.bib_access_token Method
bib_access_token(url; renew = false) -> StringThe token to fetch bibliography address url with: a signed-in one, renewed with its refresh token when it is about to expire (or renew), else a pasted one, else "". A sign-in the site no longer renews is forgotten, and the card asks to sign in again.
KaimonSlate.NotebookServer.bib_endpoint Method
The address fetched for a bibliography line: a .bib URL as given, else the site's api/bib.
KaimonSlate.NotebookServer.bib_key_matches Method
bib_key_matches(entries, q, n) -> VectorThe entries whose key, author or title contains q (ignoring case), at most n: those whose key starts with it first, then those whose key contains it, then the rest, each group by key.
KaimonSlate.NotebookServer.bib_oauth_metadata Method
bib_oauth_metadata(url) -> Union{Dict,Nothing}What the site of url says of signing in to it (RFC 8414), when it offers a token to read with (scope read); nothing for a site that does not, which is given a token instead.
KaimonSlate.NotebookServer.bib_oauth_ref Method
The secret ref holding a sign-in by OAuth for a bibliography address's host (see bib_token_ref).
KaimonSlate.NotebookServer.bib_remote Method
bib_remote(url; nb = nothing, refresh = false) -> BibRemoteThe bibliography at url (an endpoint from bib_endpoint) as the hub has it now. A copy older than BIB_RECHECK_SECONDS, or refresh, starts a fetch in the background; nb is redrawn when it brings a change.
KaimonSlate.NotebookServer.bib_signin_finish Method
bib_signin_finish(state, code) -> StringThe site sent the person's browser back with code for the sign-in state: exchange it for tokens, keep them, and fetch the bibliography with them. Returns the bibliography address signed in to.
KaimonSlate.NotebookServer.bib_signin_start Method
bib_signin_start(url, redirect) -> StringBegin signing in to the site of bibliography address url: the address of its approval page for the person's browser. redirect is the hub's callback as that browser reaches it (see bib_signin_finish). The hub registers itself there once per callback address.
KaimonSlate.NotebookServer.bib_token_ref Method
The secret ref holding the API token for a bibliography address's host (bib:host[:port]).
KaimonSlate.NotebookServer.bib_token_set! Method
Save (empty: remove) the API token for a bibliography address's host, and fetch it again.
KaimonSlate.NotebookServer.brief_of Method
brief_of(nb, role) -> DictEverything a specialist was given: standing instructions, the tools it may call, and its opening turn. The first two go in at spawn and never appear on the event bus, so without this they are invisible — and an answer cannot be judged without seeing the question.
KaimonSlate.NotebookServer.broadcast_specialist Method
Push a specialist-framework event to every open page, tagged with the role it belongs to.
Its own channel, not the debugger's. Everything here — a blocked question, a sign-off, a specialist arriving — happens to every kind of specialist, and pushing it on debug: gave it only a debugger-shaped place to appear. A surface listens on specialist: and filters on role, so a profiler's question reaches a profiler's pane without either knowing about the other.
KaimonSlate.NotebookServer.build_site! Method
build_site!(dir, nb; site_url="", slug="", bundle=false, kwargs...) -> NamedTupleAssemble/merge nb into the static site at dir (created if absent) WITHOUT any git — build the doc's <slug>/ (or the home front page), upsert slate-site.json, and (re)write the client-side index. The deploy-only building block: render locally, commit dir, let CI just push it. Point several notebooks at the SAME dir to accrete a multi-doc site. site_url is the eventual base URL (for absolute OG tags / bundle fetch); "" ⇒ page-relative. Returns (; home, slug, docUrl, ...).
KaimonSlate.NotebookServer.catalog_add_registry! Method
catalog_add_registry!(nb) -> DictAdd the extension registry to the depot the notebook's worker runs in. Separate from installing a package, and separately consented in the UI: a registry is depot-global, so it affects every project on that machine, not just this notebook.
It runs on the WORKER, not the hub: a notebook on a remote region resolves packages against the remote depot, and adding the registry here would silently do nothing for it.
KaimonSlate.NotebookServer.catalog_install! Method
catalog_install!(nb, name; target = "notebook") -> DictInstall a catalog extension into the notebook's environment. Adds the registry first if it's missing — an install that fails with "package not found" because the registry was never added is a dead end the user can't diagnose from the error.
Returns the notebook_pkg_op! result, plus registryAdded when this call had to add the registry.
KaimonSlate.NotebookServer.catalog_registry_installed Method
Is the extension registry installed in this depot? The gallery shows a one-time consent prompt when it isn't, since adding a registry is depot-global rather than notebook-local.
KaimonSlate.NotebookServer.catalog_update! Method
catalog_update!(nb, name; target = "notebook") -> DictUpgrade an already-installed extension to the newest version its environment allows. Distinct from catalog_install! because adding a package that is already a dependency keeps the resolved version — the version shown as out of date in the gallery would simply stay put.
target = "project" updates it in the enclosing project instead, for an extension the notebook inherits rather than owns.
KaimonSlate.NotebookServer.catalog_view Method
catalog_view(nb; force = false) -> DictThe full gallery payload: every catalog entry annotated with this notebook's state (installed, installedVersion, inParent), plus the categories present and where the data came from. The annotation is what lets one list serve both "browse" and "manage" — an installed extension is the same card with a different action.
KaimonSlate.NotebookServer.cell_image Method
cell_image(nb, cell) -> Vector{UInt8} | nothingA PNG of the cell's rendered figure, regardless of where it was drawn: the server-side raster (CairoMakie image/png) if present, else the latest client-captured snapshot (ECharts). nothing if the cell has no viewable figure.
KaimonSlate.NotebookServer.cell_image_fresh Method
cell_image_fresh(nb, cell) -> Vector{UInt8} | nothingLike cell_image, but first refreshes the client-rendered raster from the open browser tab so slate.view is never stale. ECharts cells push a fresh PNG on every render and CairoMakie cells carry an authoritative server-side raster, but markdown / tables / plain-value cells only get a raster on demand — so without this, view returns whatever the last inspect happened to capture. We ask the open tab to recapture (the same round-trip inspect uses; for native-figure cells it's a no-op that leaves the higher-fidelity snapshot intact), then read the freshly-stored image. Skips the round-trip for server-side rasters, and falls back to the last snapshot when no tab is open or the capture times out.
KaimonSlate.NotebookServer.cell_inspect Method
cell_inspect(nb, cellid) -> StringEverything about one cell for the agent's build loop: state (kind/state/deps/reads/writes/ duration/flags), source, the canonical result, and the cell's edit history. The live rendered DOM + optional raster come from the open browser via a separate path (see slate.inspect).
KaimonSlate.NotebookServer.checker_flag! Method
checker_flag!(nb, cell, what) -> DictThe checker found something. cell is required — a finding that cannot point at a cell is an opinion, and the reader has no way to act on it.
KaimonSlate.NotebookServer.checker_ok! Function
checker_ok!(nb, note) -> DictThe checker looked and found nothing. Recorded rather than discarded: "reviewed, clean" is information, and it is the only thing that distinguishes a working reviewer from a dead one.
KaimonSlate.NotebookServer.chrome_status Method
chrome_status() -> (; path, problem)The browser the deck captures, prints and videos use: KAIMONSLATE_CHROME if it is set, else the first Chrome, Chromium, Edge or Brave found in the usual install places or on the PATH. path is nothing when there is none, and problem then says why, naming a KAIMONSLATE_CHROME that points at no file.
KaimonSlate.NotebookServer.clear_scratch! Method
Empty the notebook's scratchpad and tell the browser to clear its panel.
KaimonSlate.NotebookServer.close_notebook! Method
Remove a notebook from the hub: drain its SSE connections and drop it.
KaimonSlate.NotebookServer.debug_briefing Method
The opening turn for a debugging specialist: this notebook, this cell, right now.
KaimonSlate.NotebookServer.debug_started_at Method
When this notebook's latest debug session started, or 0.0 if none has.
KaimonSlate.NotebookServer.deck_hold_times Method
deck_hold_times(steps, seconds) -> Vector{Float64}How long each step stays on screen in a video seconds long: at least its motion (t1 - t0) and a beat, otherwise in proportion to its weight (rehearsed timing, else reading time). Errors when the motion alone is longer than seconds.
KaimonSlate.NotebookServer.deck_pdf Method
deck_pdf(url; timeout = 120) -> Vector{UInt8}A PDF of the deck at url (from deck_print_url) as the audience sees it: one page per slide at its last step, or per step of each slide, each the slide's own size. Text and SVG stay vector; a chart is the snapshot the deck shows.
KaimonSlate.NotebookServer.deck_render Method
deck_render(url, out; seconds, fps = 30, width = 1920, height = 1080, progress = msg -> nothing)Render the deck at url (a notebook URL with ?deck=1.0&render=1) to an MP4 at out, seconds long, with a WebVTT chapter per slide beside it. Needs ffmpeg on the PATH.
KaimonSlate.NotebookServer.deck_render_start! Method
deck_render_start!(nb, base; seconds, fps = 30, theme = "") -> DictStart rendering notebook nb's deck to a video seconds long, served from base (the hub's URL), in the background, into recordings/ beside the notebook, in Slate palette theme ("" for the default). One render per notebook at a time. Returns the status that deck_render_status reports.
KaimonSlate.NotebookServer.deck_shot Method
deck_shot(url; width = 1600, height = 900, timeout = 90) -> (png, position, tex_errors)A PNG of the page at url (a notebook URL with ?deck=S.K&shot=1, or ?deck=sheet&shot=1 for the whole deck) once it marks itself ready, the deck's position line (slide and step counts) as the page shows it, and the messages of any math that failed to typeset. A contact sheet taller than the window is captured whole.
KaimonSlate.NotebookServer.defining_cell Method
Which cell defines name, or "". The LAST one wins, which is the binding actually in scope.
KaimonSlate.NotebookServer.doc_bundle_default_dir Method
doc_bundle_default_dir(nb) -> StringWhere a notebook's bundle goes when nobody says: docs/slate/<name> under the nearest enclosing directory whose docs/ has a make.jl (a notebook inside docs/ finds the one it is in). With none, docs/slate/<name> under the notebook's project, or beside the notebook when it has no project (its environment then lives in a directory the author never sees).
KaimonSlate.NotebookServer.doc_bundle_inputs Method
doc_bundle_inputs(notebook_path) -> Vector{Pair{String,String}}What a notebook's rendered output depends on, as file => SHA-256 pairs sorted by file, each file named relative to the notebook's directory:
the notebook itself, under
"(notebook)"so that its name does not enter the key;its environment: the project it runs in (the nearest
Project.tomlabove it), any workspace roots over that, and the manifest that resolves them;every package that environment takes by
pathin[sources]: its project file and the files in its directories, apart from hidden ones,docs/andtest/(and, in a git repository, files git ignores);files the notebook names by a literal path in
include("…")or@asset "…".
Line endings are normalised throughout, so a checkout with core.autocrlf agrees with the machine that rendered the bundle.
KaimonSlate.NotebookServer.doc_bundle_key Method
doc_bundle_key(notebook_path) -> StringThe key a doc bundle is stored under: one SHA-256 over doc_bundle_inputs, so a bundle is current while the notebook, its environment, the packages that environment takes by path and the files the notebook reads are all as they were when it was rendered. A docs build compares this against the key recorded in the bundle.
KaimonSlate.NotebookServer.doc_bundle_name Method
doc_bundle_name(nb) -> StringThe name a docs page gives a @slate block to show this notebook's bundle: the notebook's file name without .jl.
KaimonSlate.NotebookServer.doc_summary Method
doc_summary(doc; lines = 4) -> StringThe part of a docstring worth showing in a RESULT LIST: its prose, not its signature.
A Julia docstring conventionally opens with its signature, which @doc renders as a fenced block. In a result list the signature is the least useful part: it restates what the reader typed, while the prose is what tells them whether this is the symbol they want.
Skips one leading fenced block, then takes the first lines non-blank lines of what follows. A docstring that is only a signature falls back to that signature rather than to nothing.
KaimonSlate.NotebookServer.ensure_docs_fts! Method
Mirror the docs collection's text + metadata payloads into Kaimon's FTS index (the plain upsert path doesn't), so lexical name/substring search AND module filters work. Idempotent; best-effort if FTS is unavailable. The auto-index path calls this; the manual index_docs tool too.
KaimonSlate.NotebookServer.eval_debug Method
Evaluate in the paused frame — where the values are, which may be another machine.
KaimonSlate.NotebookServer.expand Method
expand(jl_path; target="") -> StringReinflate a standalone .jl (one carrying a Slate.bundle footer) into a project directory at target (default: <jl>.expanded/). A REPO-ROOTED bundle expands to a real git checkout of the original project (its src/, notebooks/, …) with the LIVE notebook cells in place, wired to origin (branch & PR with matching SHAs). A FLAT bundle writes Project + Manifest, any local/ package source, and the notebook at the root. Returns the target dir.
KaimonSlate.NotebookServer.export_app Method
export_app(nb, dir; appdefaults=Dict(), port=0, agent=false, history=false) -> StringWrite a self-contained application for nb into dir (created if absent), and return dir.
The folder holds the notebook's reproducible bundle plus launchers. Running julia run.jl inside it — here, or on any machine you copy it to, needing only Julia 1.12+ — installs the environment, reconstructs the notebook's exact packages, and serves it as an app: prose, results, figures and live controls, with the authoring API refused server-side. Windows users double-click run.bat.
appdefaults sets the presentation a visitor gets before expressing a preference of their own (build it with app_defaults). port pins the port (0 = pick a free one; SLATE_PORT overrides at run time). agent=false by default — an app's readers are not authoring, so the in-notebook agent is off unless you ask for it.
What ships: by default the project's git-TRACKED files — the right default, since it carries the source and leaves out build output, scratch and stray artifacts. include names extra project-relative files or directories to carry anyway. Reach for it when part of the app is deliberately untracked: reference data under the notebook's datadir() is git-ignored by construction (that directory self-ignores so a stray database is never committed), so an app whose samples live there arrives unable to load them —
export_app(nb, dir; include = ["assets/spectra"])A project with no commits has no tracked files at all, so the bundle falls back to a partial copy; export_app warns when it sees that, because the result looks fine until it is deployed.
There is no authentication. Anything that can reach the port can drive the app and read its results; treat "who can reach this port" as the entire access-control story.
KaimonSlate.NotebookServer.export_doc_bundle Method
export_doc_bundle(nb, dir; light = "daylight", dark = "midnight", render_info = Dict()) -> DictWrite nb's doc bundle into dir, replacing any bundle already there, and return the manifest. light/dark are the Slate palettes the embedded cells use under the docs site's light and dark themes. render_info is merged into the manifest's rendered record (how and where it was run).
The bundle is assembled in a sibling temporary directory and moved into place at the end, so a render that fails leaves the previous bundle intact.
KaimonSlate.NotebookServer.export_gist Method
export_gist(nb; kwargs...) -> NamedTupleCreate a secret GitHub gist holding this notebook's self-contained HTML export, via the authenticated gh CLI. kwargs are the export_html options (theme/charttheme/override/code/ outputs/width/include_source). The gist carries the <slug>.html page plus a README.md that signposts it as a downloadable HTML page (a raw gist shows source, not the rendered page). Returns (; ok, url, preview, raw, curl, error) — preview renders it via gistpreview.github.io, raw is the file's raw URL, curl a ready-to-share download one-liner. Best-effort and never throws: a missing/unauthenticated gh comes back as ok=false with a human-readable error.
KaimonSlate.NotebookServer.export_markdown Method
export_markdown(nb; include_source=true, outputs="all") -> StringSerialize the notebook to GitHub-flavored Markdown for copy-paste (Discourse / Slack / GitHub / Obsidian / docs). Prose rides verbatim; [@cite] and [@fig:label] render to their in-text form (per the notebook's bibstyle) with a trailing References section; code cells become fenced julia blocks, each followed by its outputs in a blockquote; text outputs are fenced astext; figures / frozen charts embed as a markdown image whose source is a base64 data: URI; tables become GFM tables. Data-URI images are self-contained but not every host renders them (GitHub strips them) — for those, upload the standalone .jl (+ a PNG/SVG) alongside.
KaimonSlate.NotebookServer.export_pdf Method
export_pdf(nb; include_source=true, style="article", columns=1,
theme="light", code="normal", body="normal") -> Vector{UInt8}Render the notebook to a publication-quality PDF via Typst and return the bytes. style ∈ ("article", "report") picks a layout preset; columns ∈ (1, 2) lays the body out single- or two-column; theme ∈ ("light", "dark") sets the colour scheme (dark matches the live UI and Makie-dark figures). code ∈ ("normal","small","smaller","tiny") sets the code-listing font size, or "hidden" to omit source entirely (also honoured via include_source). body ∈ ("large","normal","compact","small") sets the prose font size (defaults to "compact" for two-column). Figures use vector data when available (CairoMakie PDF, ECharts SVG). @bind controls are omitted by default (a PDF is a static snapshot); set include_params=true to show them frozen to their current values as a parameter strip.
Document metadata is authored as role-tagged cells (#%% md id=… title / abstract / bibliography): the title/abstract are hoisted into an academic title block. With no title cell the document title falls back to the first markdown H1 (then the notebook filename).
KaimonSlate.NotebookServer.export_site Method
export_site(nb; kwargs...) -> Vector{UInt8}Build a self-contained, publishable website for the notebook — index.html (the HTML export, wired to an og-image.png sidecar so a shared link unfurls with a preview) plus that image — as a gzip-compressed tarball. Unpack it into a gh-pages branch / any static host. HTML options (theme, code, outputs, include_source) pass through to the page.
KaimonSlate.NotebookServer.export_to_site Method
export_to_site(nb, name; slug="", bundle=false, base_url="", kwargs...) -> NamedTupleExport nb into the persistent LOCAL site name (created if new), served by the hub at /sites/<name>/. A home notebook becomes the front page; any other notebook gets its <slug>/. The local mirror of [publish_site] — same build_site!, no git/GitHub. Returns (; url, site, slug, home, docCount, dir) where url is the hub-relative path to open. base_url (the site's hub URL) is baked into absolute OG/bundle links when given; "" ⇒ page-relative (fine for local).
KaimonSlate.NotebookServer.export_typst_bundle Method
export_typst_bundle(nb; <same options as export_pdf>) -> Vector{UInt8}The complete Typst PROJECT — doc.typ plus every figure / markdown / code-listing asset it references — as a gzip-compressed tarball (.tar.gz). Unpack it and typst compile doc.typ reproduces the PDF, so the layout and preamble can be tweaked by hand.
KaimonSlate.NotebookServer.facts_changed! Method
facts_changed!()Something the facts describe has changed: a worker connected or went, a host signed in or out, a region started placing or preparing. Schedules a refresh shortly, so a burst of events costs one.
KaimonSlate.NotebookServer.facts_refresh! Method
facts_refresh!() -> IntRecompute the facts from their sources and publish what changed. Returns the revision.
KaimonSlate.NotebookServer.facts_snapshot Method
The whole published set, as a page loads it before the stream's deltas.
KaimonSlate.NotebookServer.fetch_catalog Method
fetch_catalog(; force = false) -> (entries, meta)The published catalog, cached under the cache home and revalidated with an ETag. Returns the entry vector and a meta Dict describing where it came from (source, fetched, error).
Never throws: a network failure falls back to the cache, and an absent cache falls back to the local registry clone. The gallery must open even with no network, because the packages it lists may already be installed.
KaimonSlate.NotebookServer.figure_index Method
figure_index(report) -> (; numbers, labels, capfor)Resolve figure numbering from caption-tagged cells (document order):
numbers:: caption-cell-id → Figure number (Int)labels:: cross-ref label → (num, anchor) (label =label=attr, else the caption cell id; anchor = the bound figure cell's id when known, else the caption cell id). Each label is also registered under afig:prefix, so both[@x]and[@fig:x]resolve.capfor:: caption-cell-id → bound figure cell id ("" if none resolved)
KaimonSlate.NotebookServer.forget_consents! Method
Drop every standing grant for a notebook — its work is over.
KaimonSlate.NotebookServer.forget_debug! Method
Drop a closed notebook's breakpoints — the ids are reused when the same file is reopened.
KaimonSlate.NotebookServer.forget_findings! Method
Drop a closed notebook's findings — ids are reused when the same file is reopened.
KaimonSlate.NotebookServer.forget_profiles! Method
Drop what the hub holds for notebook id's profiles (kept ones stay on disk); ids are reused on reopen.
KaimonSlate.NotebookServer.forget_specialists! Method
Drop a closed notebook's specialist state — ids are reused when the same file is reopened.
KaimonSlate.NotebookServer.format_texts Method
format_texts(nb, sources; formatted = nothing) -> (; formatted, failed, formatter)Format code-cell texts without changing the notebook: sources maps cell id → text, formatted in the result maps id → its formatted text, and the caller applies it. With formatted given (id → output, from a formatter that ran in the browser) that output is checked instead of running Runic. A cell whose output is not the same program is left out and reported in failed, as is a cell that does not parse when Runic is the formatter.
KaimonSlate.NotebookServer.frame_debug Method
The current frame without advancing. session says whether there is one at all.
KaimonSlate.NotebookServer.gate_namespace Method
The gate namespace this extension is serving under, which prefixes every tool name an agent sees.
Read at call time, never written down: an allowlist naming tools that do not exist does not fail, it silently stops restricting — which is how the first specialist came to call a tool that was never meant to be in its world.
KaimonSlate.NotebookServer.grant_agent_permission! Method
Grant this notebook's agent a permission preset, from its next message on.
A preset is fixed when the agent process spawns, so the running agent keeps the one it has. It is not reaped here: the agent asking for this is blocked inside a tool call, and killing it now would throw away the answer it is waiting for. The next message finds a preset that no longer matches what the live agent spawned with, and respawns it.
KaimonSlate.NotebookServer.index_docs! Method
Embed + upsert harvested doc records into the search index. Returns the number of symbols ACTUALLY written — 0 when the backend is unreachable, and short of length(records) when some failed.
That distinction is the caller's only signal. _autoindex! persists "indexed at version X" into the durable cache on the strength of it, and a version once recorded is never revisited: reporting a run that reached no Qdrant as a full success left those packages permanently unindexed, with search_docs quietly returning nothing for them.
KaimonSlate.NotebookServer.interpret_debug! Method
Add or drop a module from the set this session steps rather than runs compiled.
Dropping is the counterpart to admitting. Every line steps while a module is in the set, so leaving a library in after the question is answered slows the rest of the session.
KaimonSlate.NotebookServer.into_debug! Method
Step into the call at lowered statement pc, admitting admit to the interpret set first.
Ungated like every other step, for the reason given on step_debug!.
KaimonSlate.NotebookServer.into_targets_debug Method
The calls the paused line still has to make, so into can be told which one is meant.
Every call is reported, library ones included, each saying whether the session interprets its module. Which to OFFER is the viewer's decision; the browser hides library calls by default.
KaimonSlate.NotebookServer.jet_in_env Method
jet_in_env(nb) -> Union{Bool,Nothing}Whether the notebook's environment (its own packages or its parent project's) has JET, which turns on the static check; nothing when the environment could not be read.
KaimonSlate.NotebookServer.keymap_config! Method
keymap_config!(cfg) -> Dict{String,Any}Validate and persist a keymap, returning what was stored. Written whole rather than merged: the body IS the user's keymap, and merging would make a removed binding unremovable.
KaimonSlate.NotebookServer.keymap_config Method
keymap_config() -> Dict{String,Any}The stored keymap, or the empty default (preset = "slate", no overrides). Never throws. An unreadable file means someone hand-edited it into invalid JSON, and the notebook should still open, on the default keymap.
KaimonSlate.NotebookServer.last_prepare Method
The last compile of cid, or nothing.
KaimonSlate.NotebookServer.last_profile Method
The latest profile of cid: the one taken since the hub started, else the newest kept.
KaimonSlate.NotebookServer.latest_finding Method
The most recent finding for this notebook, or nothing.
KaimonSlate.NotebookServer.live_watch! Method
live_watch!(nb, source; on) -> DictAdd or remove a live watch. source is Julia, or cell:<id> to track a cell.
KaimonSlate.NotebookServer.local_registry_entries Method
local_registry_entries() -> VectorCatalog entries built from the extension registry's clone in the depot: name, uuid, version, repo. No prose — that lives in the published artifact — but always accurate about what can be installed, which is what makes this a usable fallback rather than an empty screen.
KaimonSlate.NotebookServer.mark_debug! Method
mark_debug!(nb, file, line; on, cond, enabled) -> DictArm or clear a breakpoint. on === nothing toggles, which is what a gutter click wants. Allowed with no session running: marking a line and then starting is the normal order of the work.
enabled silences a breakpoint without clearing it. The line stays listed and drawn hollow, with its predicate intact. Passing it alone changes only that flag.
KaimonSlate.NotebookServer.may_disturb Method
May who disturb this notebook's session — end it, or start a different one over it?
Yes when there is nothing running, when they own it, or when they are a person: it is their notebook. Yes also for the ORCHESTRATOR that summoned the specialist holding it, because supervising includes deciding the work is finished — an agent that can start a specialist but not stop one is not supervising it, only launching it. That is the one case where an agent may end another's session, and it exists only because summon! recorded who summoned whom.
No for any other agent, which is the case that matters: one reaching for a session a human is using. It has to ask (see request_consent), the same way Kaimon's own debug tools will not resume out from under someone who is still looking around.
KaimonSlate.NotebookServer.note_external_tool! Method
note_external_tool!(nb, agent_id, toolname, args, result; ok=true)Gate on caller identity, then surface the write if it came from outside this notebook's crew. agent_id is KaimonGate.current_agent_id() for the call: "" for an outside MCP client (always external), or the owning Kaimon agent's id — external only when it is NOT one of THIS notebook's crew agents, whose calls the agent:<id> relay already streams into the pane (surfacing those here would double them).
KaimonSlate.NotebookServer.note_persist! Method
Note that the notebook was saved, and work out what changed.
Hooked to the persist rather than to the agent's cell tools: a persist is where EVERY mutation ends up, whoever made it. An agent editing a cell, a person typing in the browser and a file changing on disk are the same event here, and a reviewer that only saw the agent's edits would miss the ones most worth reviewing — the ones nobody else reviewed either.
Marks only. What wakes the checker is the notebook going quiet, so a burst of edits becomes one review of the finished state rather than one review per keystroke of a state nobody was looking at.
KaimonSlate.NotebookServer.notebook_docid Method
notebook_docid(nb) -> (; docId, sourceRepo, sourcePath)The document's stable ledger identity. It is a one-time id embedded in the notebook (meta["docid"], persisted to the .jl footer), so it never changes when the file moves or the repo gains/loses an origin — the failure that used to split one notebook into two ledger entries. Generated + persisted on first use. sourceRepo/sourcePath are derived from git purely for DISPLAY.
KaimonSlate.NotebookServer.notebook_formatter Method
notebook_formatter(nb) -> DictThe formatter nb uses: name, from (notebook, fatou.toml, global or default), and for Fatou the config to hand the plugin.
KaimonSlate.NotebookServer.nudge_checker! Method
Wake the checker, if it is on and enough time has passed.
Called when the notebook agent finishes a turn. Detached and swallowed: a reviewer is an optional extra, and nothing about the agent's turn may wait on it or fail because of it.
KaimonSlate.NotebookServer.og_image Method
og_image(nb) -> Vector{UInt8} | nothingThe social-preview image for the notebook. In priority order: the figure of a cell explicitly tagged thumbnail (or og); else the first real figure in the notebook (a CairoMakie raster, chart, or animation — never a snapshot of text/value output); else a generated title card; else nothing. Used as the og:image for a published page.
KaimonSlate.NotebookServer.open_notebook! Method
open_notebook!(hub, path) -> idLoad the notebook at path into the hub (reusing the existing entry if already open) and start its file watcher. Returns the hub id (its /n/<id> route).
KaimonSlate.NotebookServer.owner_label Method
A name a person can read for whoever holds a session: a specialist by its role, the notebook's own agent as such, and anything else reaching in over MCP as an external agent.
KaimonSlate.NotebookServer.pending_released_notice Method
A release the notebook has not been told about yet, or nothing.
KaimonSlate.NotebookServer.prepare_now! Method
prepare_now!(nb, cid) -> Dictprepare_profile!, waited for: the prepared push, or ok = false with why.
KaimonSlate.NotebookServer.prepare_profile! Method
prepare_profile!(nb, cid) -> DictCompile cell cid's code where it runs, without running it, in the background. The page hears preparing, then prepared with what was compiled.
KaimonSlate.NotebookServer.previous_profile Method
The profile of cid before the latest taken the same way (mode and side), or nothing.
KaimonSlate.NotebookServer.profile_briefing Method
The opening turn for a profiler: this notebook, this cell, and its last profile if there is one.
KaimonSlate.NotebookServer.profile_eval Method
profile_eval(nb, cid, code) -> StringEvaluate code on the kernel cell cid runs on, in the notebook's namespace, and return what it printed and its value: @code_warntype f(x), @allocated, a timing at the types the cell uses.
KaimonSlate.NotebookServer.profile_history Method
The profiles kept of cid, newest first, as their facts.
KaimonSlate.NotebookServer.profile_load Method
A kept profile of cid by its id, or nothing.
KaimonSlate.NotebookServer.profile_now! Method
profile_now!(nb, cid; mode, opts...) -> DictProfile cell cid: ask for a profile of its next run and run it as its ▶ would (so its output, bindings and memo entry are the run's). Returns the profile's push once the run is over, or kind = "waiting" when the cell is waiting (for a node, say), in which case the profile is taken when it runs and pushed then.
KaimonSlate.NotebookServer.profile_source Method
profile_source(nb, cid, file) -> DictThe text of file for the profile's code pane. A cell's file (cell:<id>) is the notebook's own text, which no kernel has; anything else is read on the machine the cell ran on.
KaimonSlate.NotebookServer.profile_source_text Method
profile_source_text(nb, cid, file; line, around) -> Stringfile as the machine the cell ran on has it, with each line's share of the run, around line.
KaimonSlate.NotebookServer.profile_static_text Method
profile_static_text(nb, cid) -> StringThe static check of cid's last compile in words: each finding where it lands in the reader's code, and, for one inside a library, the call it ends in.
KaimonSlate.NotebookServer.profile_summary_text Method
profile_summary_text(nb, cid) -> StringThe last profile of cid in words: run facts, the change from the run before, the lines that cost the most of their own time, and the hot path under each of the cell's heaviest lines.
KaimonSlate.NotebookServer.profile_tree_text Method
profile_tree_text(nb, cid; at, depth, min) -> StringThe line-keyed tree under at ("" for the whole cell, file:line, or a function name), down to depth levels and leaving out anything under min percent of the run.
KaimonSlate.NotebookServer.provenance_note Method
Where the names in expr come from, as a line to append to a value an agent just looked at.
Empty when nothing in the expression is a notebook binding — a frame local has no cell, and saying so every time would be noise on the majority of evaluations.
KaimonSlate.NotebookServer.publish_doc_set_targets! Method
Assign/replace the set of target names on this notebook's document (persisted).
KaimonSlate.NotebookServer.publish_document! Method
publish_document!(nb, ledger, docId, store; target_names=nothing, on_event=nothing, kwargs...)
-> Vector{PublishResult}The top-level publish action: deploy docId to each of its ledger targets (or the given target_names) concurrently, append one Event per target to ledger, persist through store (load-merge-save), and return the per-target results. on_event streams per-target progress.
KaimonSlate.NotebookServer.publish_ledger_view Method
The whole ledger as the manager's view model (loads via the default store — may hit the network for gist).
KaimonSlate.NotebookServer.publish_preflight Method
publish_preflight(repo) -> NamedTupleInspect (read-only, no mutation) what publishing to repo would do, so the UI can warn before acting: whether gh is available, the repo exists, its visibility, and whether it already has a gh-pages branch / live Pages site that a publish would overwrite.
KaimonSlate.NotebookServer.publish_secret_set! Method
Set (empty value ⇒ delete) a secret by ref; returns the sorted list of ref NAMES (never values).
KaimonSlate.NotebookServer.publish_set_doc_build! Method
Set the build settings recorded for one document of site — the publishing manager's per-doc editor, so a page's settings can be changed without opening its notebook.
When the notebook is open the doc is rebuilt straight away, so the local build matches what was just recorded. When it isn't, only the record changes: Sync deploys the staged copy verbatim and never re-renders, so the page keeps its old build until the notebook is opened and the site Staged. Returns whether it rebuilt, so the caller can tell the user which of the two happened.
KaimonSlate.NotebookServer.publish_set_home! Method
Set/clear whether this notebook is site's front page. Front page is driven by the home tag (model A): this toggles the tag and rebuilds the notebook into the site so its home reflects the change. Setting it as home for one site clears it as home elsewhere it's built (the tag is notebook-global for now).
KaimonSlate.NotebookServer.publish_set_membership! Method
Associate (build into) or disassociate (remove from) this notebook and a site's canonical local build. Local only — a subsequent Publish/Sync deploys. Returns the refreshed publish_sites_info.
build is the publish panel's options, used only when the site doesn't know this doc yet: adding a notebook with "Run live" ticked has to build it that way, which is what this argument is for. Once the site HAS the doc, its recorded settings win, so re-ticking a site (or toggling ★) can't overwrite settings edited in the publishing manager.
KaimonSlate.NotebookServer.publish_site Method
publish_site(nb, repo; private=false, create=true, kwargs...) -> (; url, repo, created, pagesEnabled, pagesError)Publish the notebook as a GitHub Pages site to repo ("owner/name"), using the user's installed + authenticated gh CLI. If the repo is missing and create is set, it's created with the requested visibility (private); the built site is force-pushed to gh-pages, Pages is enabled, and the URL returned. An EXISTING repo's visibility is left untouched. Idempotent — re-runs just update the branch. Requires gh on PATH and gh auth login. (Pages needs a PUBLIC repo on the free plan.)
KaimonSlate.NotebookServer.publish_site_delete! Method
Delete a site. Local removal always: the ledger definition AND the local canonical build dir go away. purge=true additionally tears down deployed content on each of the site's targets where feasible (see purge_deployed!). The view gains a purgeLog entry when a purge ran.
KaimonSlate.NotebookServer.publish_site_set! Function
Create/update a site: its destination targets, home doc, display title ("" ⇒ the site name), and optional per-target subpaths (target → path within that target; "" ⇒ its root). Refuses a (target, subpath) location already claimed by another site — they'd overwrite each other. Membership/order/sections live in its local build.
KaimonSlate.NotebookServer.publish_sites_info Method
For THIS notebook: every site with {member, isHome, targets, url}, plus the known targets — the read model the notebook's Publish panel paints. Membership is matched on the notebook's stable docid alone (see _doc_entry_is); front page is the site's built home (site_frontpage).
KaimonSlate.NotebookServer.publish_target_delete! Method
Delete a target definition. Removal is LOCAL by default: the ledger entry goes away and every reference (documents AND sites) is detached — deployed content stays live. purge=true also tears down the deployed side where feasible (see purge_deployed!; rsync-serve stops its remote server and removes the served dir). The view gains a purgeLog entry when a purge ran.
KaimonSlate.NotebookServer.publish_to_site! Method
publish_to_site!(nb, siteName; on_event=nothing, deploy=true, slug="", kwargs...) -> summaryBuild nb into the site's canonical local copy (staging it as a member — stamping its source + id), and when deploy=true also Sync the whole build to every destination. deploy=false STAGES only (the local copy is built, nothing is deployed) — the "add a notebook" path under the Stage→Sync model. kwargs are the site-build options (bundle/history/…).
KaimonSlate.NotebookServer.publish_to_targets Method
publish_to_targets(nb, targets; on_event=nothing, kwargs...) -> Vector{PublishResult}Deploy nb to every PublishTarget concurrently, preserving input order in the result vector. on_event, if given, is called on_event(i, :start, target) then on_event(i, :done, result) for each target — the seam the manager UI streams over SSE. Targets are isolated: a throwing/failing target yields an ok=false result and never aborts its siblings.
KaimonSlate.NotebookServer.purge_deployed! Method
purge_deployed!(t::PublishTarget) -> (; ok, log)Tear down what a target DEPLOYED, where that's feasible — the opt-in purge of the removal flows. Only self-hosted kinds can genuinely undeploy; for static hosts (GitHub Pages / Cloudflare / Netlify / buckets) this is a documented no-op — remove the deployed content from the host's own console (or push an empty site) instead.
KaimonSlate.NotebookServer.record_publish_site! Method
record_publish_site!(nb, repo, result) -> StringReflect a successful publish_site to repo in the ledger: ensure a github-pages target for the repo (auto-named, reusing an existing one), ensure this notebook's document (assigned to that target), and append a publish event (live URL, commit SHA, deploy status). Returns the target name. Best-effort — a ledger failure is logged and never fails the publish itself.
KaimonSlate.NotebookServer.recording_chunk! Method
Append bytes to the recording. false when rid is not a live recording of nbid.
KaimonSlate.NotebookServer.recording_finish! Method
recording_finish!(nbid, rid; vtt, timings) -> Union{Dict,Nothing}Close the recording: write the chapters (vtt, WebVTT text) and the slide timings (timings, any JSON value) beside the media file, and drop the id. A webm is transcoded to mp4 in the background when ffmpeg is available, since browsers record webm without a seekable index and many players won't open it; the webm is kept if that fails.
KaimonSlate.NotebookServer.recording_start! Method
recording_start!(nbid, nbpath; mime) -> DictOpen a new recording file for the notebook at nbpath and register it under a fresh random id. The extension follows the recorder's mime (mp4 or webm); the name is the notebook's plus a timestamp, suffixed if a recording with that name already exists.
KaimonSlate.NotebookServer.refresh_live_watches! Method
Re-evaluate every live watch and push the results.
Runs after a step, on the notebook's eval mutex exactly as a cell does — a live watch is ordinary notebook code and must not race the stepper's own round trip. Each result is broadcast as a cell, so the browser renders it with the SAME pipeline a cell's output uses: a plot is a plot, an echart is an echart, a table is a table. Nothing here knows what a chart is.
KaimonSlate.NotebookServer.register_orchestrator! Method
Remember who briefed this specialist, if they are an agent that can be sent to.
KaimonSlate.NotebookServer.register_specialist! Method
Register a kind of specialist. Re-registering replaces, so a reload does not stack duplicates.
KaimonSlate.NotebookServer.relay_agent_event Method
relay_agent_event(channel, data)Gate-bus callback for an agent:<id> event: forward the raw {kind,turn,data} JSON onto the bound notebook's SSE, prefixed agent: so the SPA's live-event handler routes it to the chat pane. data already rides the bus as a JSON string.
KaimonSlate.NotebookServer.render_doc_bundle_inprocess Method
render_doc_bundle_inprocess(notebook, dir; light = "daylight", dark = "midnight", timeout = 3600) -> DictRun notebook in this process and write its doc bundle to dir, returning the manifest. No hub, no browser, no worker — KaimonSlate.render_doc_bundle(…; backend = :inprocess).
The notebook runs in THIS process, in its own environment (the in-process kernel swaps the load path around each cell), so its packages must be installed. Nothing is written to Slate's own state: no preview snapshot, no history, no docs index. Cells that error are reported and still bundled, as the error output they produced — a docs build decides whether that is acceptable.
KaimonSlate.NotebookServer.reorder_published_site Method
reorder_published_site(repo, ordering) -> (; ok, changed, url, commit)Apply a new section/order to repo's published-site docs and re-push ONLY the manifest + regenerated index to gh-pages (no doc rebuild). ordering is an iterable of dicts {slug, section, order}.
KaimonSlate.NotebookServer.reorder_site! Method
reorder_site!(name, ordering) -> (; ok, docCount)Apply a new section/order to the LOCAL site name's docs and regenerate its index — no git, no deploy (Sync pushes the result to the destinations). ordering is an iterable of {slug, section, order}.
KaimonSlate.NotebookServer.request_consent Method
Ask whether who may disturb something of someone else's. true only on an explicit yes.
KaimonSlate.NotebookServer.request_live_inspect_many Method
request_live_inspect_many(nb, cellids; timeout) -> IntRasterise SEVERAL cells in the open tab in ONE round-trip, leaving each picture in the snapshot store for cell_image to read. Returns how many came back.
theme names the Slate palette to rasterise UNDER — the capture is a picture of the live page, so without it a light PDF embeds whatever the reader happens to be looking at, which is usually dark cards on white paper. The cells are captured from a copy of the page in an off-screen frame with the theme applied, so the page does not flicker and a reader watching the export sees nothing change.
One request, not one per cell. Asking cell by cell costs a push and a wait EACH, so a notebook with a dozen HTML outputs spends a dozen timeouts in series and any single slow raster quietly drops that cell from the export. The browser posts each picture store-only and then one reply to release this wait, which keeps the bodies small — a dozen full-size PNGs in one payload would be megabytes — while still costing a single round-trip. The timeout scales with the batch because the work does, and a partial answer is honest: whatever arrived is in the store, and the caller sees the count rather than discovering the gap in the finished document.
KaimonSlate.NotebookServer.review_finding! Method
Ask the checker to review a finding — a second read of a claim, by something that did not make it.
Off the caller's thread and swallowed: a review is an optional extra, and a specialist's sign-off must not wait on it or fail because of it. The finding is already in the chat by the time this runs, so the verdict lands as an annotation on something the person can already see rather than holding up the answer.
CHECKER_MIN_GAP deliberately does not apply. That floor exists to stop a burst of edits waking the reviewer repeatedly; a finding is a single deliberate event and is exactly what it is for.
KaimonSlate.NotebookServer.run_profile! Method
Profile cell cid in the background; the page follows the pushes (profile_now!).
KaimonSlate.NotebookServer.run_publish Method
run_publish(nb, target_names; archive=false, on_event=nothing, build opts…) -> summary::DictLoad the ledger, ensure this notebook's document + its targets, resolve secrets from the config home, fan out the publish concurrently (forwarding the site-build options to each adapter), record one event per target, and persist. on_event(i, phase, payload) streams progress. Throws if a named target isn't configured.
Publishing and archiving are DIFFERENT VERBS on the same store: with archive=false (default) every named target must be a re-pushable live destination — an archive kind (Zenodo) is refused, because a deposit mints a permanent immutable version and must never ride along with a site push. With archive=true the run is a deliberate archival: every named target must be an archive kind.
KaimonSlate.NotebookServer.scratch_check Method
Poll a background scratch job: its result if finished (and forget it), else a still-running note.
KaimonSlate.NotebookServer.search_docs Method
Hybrid docs search over the slate_docs index. ONE search_code call now does the query embed, the semantic+lexical fusion, and span-dedup — replacing the old _embed + _semantic_docs + _fts_docs + hand-rolled fusion (per Kaimon's SEARCH_INTEGRATION_NOTES two-tool model). modules (when non-empty) scopes to those packages via a metadata.module any-of filters on BOTH engines — pass the notebook's in-scope set (_inscope_modules) so a query can't surface another notebook's packages from the shared index. Notes: collection is required (the service endpoint has no workspace binding); embedding_model must match index_docs! (qwen3-embedding:0.6b) or the semantic arm degrades to lexical-only — which still returns name/substring hits.
KaimonSlate.NotebookServer.secret_refs Method
The configured secret ref NAMES (values never leave the process).
KaimonSlate.NotebookServer.serve_notebook Method
serve_notebook(path; host="127.0.0.1", port=8765, quiet=true, app=false, appdefaults=Dict())Open the notebook at path in a hub and serve it. Blocks until stopped (Ctrl-C shuts the hub and its workers down cleanly). Once the hub is answering HTTP, prints a framed banner with the openable notebook URL (so a launcher like run.jl surfaces a ready, clickable link rather than a bare port). With quiet=true (default) the console stays clean after the banner: the hub's log detail (worker spawns, connects, warnings) goes to a file in the same tmp dir as the worker logs — the banner shows the path; only errors still print.
KaimonSlate.NotebookServer.set_bind_by_name! Method
set_bind_by_name!(nb, name, value) -> nbSet a @bind by NAME — what set_bind(:name, value) in cell code resolves to. No-op if nothing declares it, so a stale name in a handler can't break a run.
The cell id comes from ReportEngine.bind_owner: the browser and the agent both already know which cell holds a control, but cell code names only the variable, which is the point — a notebook shouldn't have to know which of its own cells happens to declare a control in order to move it.
KaimonSlate.NotebookServer.sign_off! Method
sign_off!(nb, role, who, summary)A specialist saying it is finished, and what it found.
Deciding to stop is its own call, so this is a report rather than a request. It goes to the notebook's chat as a message from that agent — the same place its reasoning has been streaming — so the findings survive in the transcript rather than living only in a tool result that whoever asked may never read.
KaimonSlate.NotebookServer.specialist_model Method
The model a role runs on, or "" to follow the notebook's own agent model.
KaimonSlate.NotebookServer.specialist_roles_json Method
Every registered specialist role, as the Settings panel shows them.
What a role IS, rather than what it is doing: its verbs, the permission preset it spawns under, and the first line of its brief. The point of showing this is that a specialist's narrowness is the reason to use one, and narrowness you cannot see is a claim rather than a fact.
KaimonSlate.NotebookServer.stage_findings! Method
Put this notebook's findings where the serializer can write them into the footer.
KaimonSlate.NotebookServer.stage_site! Method
stage_site!(name; hub=nothing) -> {ok,url,buildDir}STAGE the site: (re)build the local copy that is EXACTLY what Sync will deploy. Re-exports every member whose notebook is open (fresh from its live state) and keeps the existing build for the rest (a closed notebook can't be rebuilt without its kernel). Deploys NOWHERE — the staged copy is local + unexposed, viewable at /sites/<slug>/. Sync later just COPIES this artifact to the destinations. Leaves the site "unsynced" (the sync stamp is untouched), since nothing was deployed.
KaimonSlate.NotebookServer.start_debug! Method
start_debug!(nb, cell; source) -> DictBegin stepping cell. source overrides the cell's saved text — the browser sends its editor's current contents, so you step what you are looking at rather than what was last written to disk.
KaimonSlate.NotebookServer.start_hub Method
start_hub(; host = "127.0.0.1", port = 8765, app = false, appdefaults = Dict()) -> HubStart one HTTP server that hosts many notebooks, and return the Hub. Notebooks are added and removed while it runs with open_notebook! and close_notebook!; stop_hub shuts it down. This is the layer the slate app itself runs on — reach for it when you are embedding Slate in your own script rather than opening a single notebook with serve_notebook.
host defaults to loopback, so the hub is reachable only from this machine; bind "0.0.0.0" to serve a network. On Linux a loopback connection is served only when it comes from the account running the hub (see _peer_is_owner), which keeps other users of a shared machine out. There is no authentication for network peers — on a non-loopback bind, whatever can reach the port can drive every notebook on it.
app = true serves in application mode: prose, results, figures and live controls, with the authoring routes refused server-side rather than merely hidden. appdefaults (build it with app_defaults) sets what a visitor sees before choosing for themselves.
KaimonSlate.NotebookServer.start_server Method
start_server(path; host="127.0.0.1", port=8765, app=false, appdefaults=Dict()) -> HubStart a hub and open the single notebook at path. Non-blocking; returns the Hub (stop it with stop_hub). The notebook is served at /n/<id> (printed); / is the index. For a blocking launcher use serve_notebook.
app=true serves the notebook as an application: the reading view (markdown, output, figures and live @bind controls — no code, no cell chrome) with the authoring API refused server-side. Presentation defaults for visitors go in appdefaults; build it with app_defaults. See server_app.jl for what app mode does and does not guarantee.
KaimonSlate.NotebookServer.step_debug! Function
next | into | out | continue.
Stepping is not gated on ownership. Two drivers on one session is confusing, but it is the person's notebook and their own hands should always work; an agent stepping a session a human owns is how you take the controls back from it mid-thought.
KaimonSlate.NotebookServer.stop_debug! Method
stop_debug!(nb; serialize = true)End the notebook's debug session if it has one. Called on close and kernel restart as well as from the UI, and that is not housekeeping: the interpreter's compiled-module scope is process-global (_scope_interpreter!), so a session left open on a region worker that merely DETACHES would hand the next notebook to adopt it an interpreter still scoped to this one's modules.
serialize=false skips the eval mutex, for teardown paths where an in-flight evaluation may still be draining and waiting for it could wedge the close. Stopping only restores a global and drops a reference, so it is safe to run beside an eval — unlike a step, which executes user code.
KaimonSlate.NotebookServer.stop_hub Method
Stop the hub: drain every notebook's SSE connections, then close the server.
KaimonSlate.NotebookServer.stop_server Method
Stop a hub started by start_server (drains SSE, frees the port).
KaimonSlate.NotebookServer.summon! Method
summon!(nb, role; subject, model, task, orchestrator) -> DictBring a specialist of kind role into this notebook and hand it subject.
model is any id the chat picker offers — an acp:<agent>:<model> id runs it on an ACP backend, which includes Claude Code itself. The turn is sent asynchronously: its reasoning and every tool call stream into the notebook's chat as it works, which is the point of summoning one rather than requesting a report.
orchestrator is the agent id doing the summoning. Registered only if it is a live Kaimon agent, because the value of knowing it is being able to hand it a turn; an id that cannot be sent to is worse than none, since a question would look delivered and never arrive.
KaimonSlate.NotebookServer.sync_site! Method
sync_site!(name; on_event=nothing, hub=nothing) -> summaryDeploy a site's ONE canonical local build (_site_dir(name)) to every one of its destination targets, concurrently and identically. on_event(i, phase, payload) streams per-target progress. Throws if the site has no local build yet or no configured destinations. Zenodo/non-host targets report an error row.
KaimonSlate.NotebookServer.target_from_ledger Method
target_from_ledger(t::PublishLedger.Target; secrets=Dict()) -> PublishTargetConstruct a runtime adapter from a ledger target config. secrets (a Dict or a ref -> value callable) resolves the target's secretRef for backends that need a token (e.g. Zenodo). CLI-based backends (github-pages via gh, s3/rsync) read their creds from the environment and don't carry a secret on the adapter.
KaimonSlate.NotebookServer.target_name Method
The target's name (its ledger key, e.g. gh:portfolio) — used to attribute the event.
KaimonSlate.NotebookServer.tell! Method
tell!(nb, role, text) -> DictSend a specialist a turn.
Whether a message can land DURING a turn is the agent's own capability, not a fact about the protocol. An agent that queues prompts takes it immediately; one that does not loses the reply in progress when a second prompt arrives, so for those the message is refused and the caller told to wait or interrupt. Asking beats assuming: refusing for everyone would borrow one agent's limitation and impose it on every backend.
KaimonSlate.NotebookServer.tool_names Method
The verbs of s as the agent will see them: <namespace>_<verb>.
KaimonSlate.NotebookServer.traces_debug Method
The samples each watched expression has collected, as plain arrays the browser can plot.
KaimonSlate.NotebookServer.unread_upstream Method
Cells that produce cid's inputs and that this investigation never looked at.
This is the whole of the structural check. A specialist naming the cell where a bad value was USED, having never looked at the cell that PRODUCED it, is reporting a symptom — and the fix it proposes will be to the code that received the value rather than to whatever made it wrong.
KaimonSlate.NotebookServer.update_notebook_format! Method
update_notebook_format!(path) -> (; backup, changes)Write the notebook at path in the current file format, keeping a copy of the original beside it first. Reading a file parses it in its own format and writing it uses the current one, so the update is a read and a write: the footers a save carries forward (a bundle, a frozen render) are carried here too. A file already in the current format is left alone (backup == "").
KaimonSlate.NotebookServer.update_vendor_lock Method
update_vendor_lock()Write assets/vendor.lock.json: for each package in assets/vendor.json, every file of its pinned version that matches the package's files patterns, with the SHA-384 of its bytes. Run it after changing vendor.json and commit the result; the server refuses vendored files the lock doesn't list or whose bytes don't match. Needs network.
KaimonSlate.NotebookServer.upstream_cells Method
Every cell cid transitively depends on.
The whole cone rather than direct dependencies: a value is often built two or three cells back, and the cell that finally mishandles it is the one an investigation is looking at when it goes wrong.
KaimonSlate.NotebookServer.wait_for_specialist Method
wait_for_specialist(nb; timeout, since) -> DictBlock until a specialist needs something, or finishes.
An orchestrator reaching this notebook over MCP cannot be pushed at — MCP is request/response — so a long poll is how that becomes a rendezvous. An orchestrator that IS a Kaimon agent gets paged directly instead (see _page_orchestrator) and needs this only as a backstop.
KaimonSlate.NotebookServer.watch_debug! Method
watch_debug!(nb, file, line; expr) -> DictSample expr every time file:line runs, without stopping. An empty expr clears the watch.
Separate from a breakpoint even when they share a line: one asks to be interrupted, the other asks to be shown a history, and you usually want both on the same line — sample every pass, stop on the pass that matters.
KaimonSlate.NotebookServer.zenodo_request Method
zenodo_request(client, method, url; json=nothing, file=nothing) -> (status::Int, body)The single HTTP primitive the deposition flow is built on. url is either a path under the client's base or an absolute URL (bucket uploads use the deposition's absolute bucket link). json sends a JSON body; file streams a file's bytes (for bucket uploads). Returns the status and parsed-JSON body (or {} on a non-JSON/empty body); never raises on an HTTP error status.
KaimonSlate.NotebookServer.@report_op Macro
@report_op nb report begin … endGuarded with_report: take nb.lock, bind report = nb.report, run the body — and at macro-expansion REJECT any direct kernel round-trip / blocking call inside the locked region (see _KERNEL_BOUNDARY), so the notebook-lock invariant can't be broken by a direct call (it would have caught the post-drain refine_usings! bug). Indirect calls through a helper still rely on the protocol + review.
KaimonSlate.NotebookServer.SlateHistory.Doc Type
Doc(key, path)A notebook's STORAGE IDENTITY. The store deliberately does not decide what makes two files the same document — the caller owns that (see NotebookServer.doc_key, which prefers the notebook's file-carried docid so history survives a move or a rename). path is provenance only: it is recorded in meta.json and nothing keys off it.
Doc(path) is the legacy identity, hashing the absolute path, and is what a notebook with no docid still resolves to — so existing stores keep loading untouched.
KaimonSlate.NotebookServer.SlateHistory.fork! Method
Copy a document's store to a new key, so a fork keeps its lineage up to the split.
KaimonSlate.NotebookServer.SlateHistory.known_paths Method
Every path this document has been recorded at, OLDEST FIRST — so the head of the list is where the document originated and everything after it is somewhere it was later copied or moved to. Empty when it has no store yet.
KaimonSlate.NotebookServer.SlateHistory.quiet_paths Method
Paths that have chosen to stop being told this document is shared. Recorded PER PATH, not per document, so one copy going quiet never silences the notice for another.
KaimonSlate.NotebookServer.SlateHistory.read_side Method
Read a per-document JSON sidecar, or nothing when there is none.
KaimonSlate.NotebookServer.SlateHistory.record! Method
record!(path, source; source_label="browser", kind="checkpoint", cells=nothing, label="") -> entry | nothingRecord a notebook snapshot. Deduped by content hash — returns nothing (and writes nothing) when source equals the latest recorded state. Otherwise appends a delta log entry, stores the (zstd) content object, and refreshes the head keyframe. cells is an iterable of (id, kind, source).
KaimonSlate.NotebookServer.SlateHistory.rehome_path! Method
Rewrite from to to in this document's recorded locations — the document did not gain a location, it MOVED to one.
For a launcher opening a downloaded standalone bundle and then re-homing the notebook to its install directory. The bundle is a real .jl that stays on disk for the run, so recorded alongside the install it makes the notebook read as one document in two places and the reader is asked to split a copy they never made. Replacing rather than adding keeps paths meaning what it says: somewhere this document actually lived.
A REPLACE, not an add-then-remove, because at this point the bundle is usually the document's only recorded path — there is nothing yet to fall back to, so a removal would have to either strand the store with no location or be deferred until the new one is recorded, which is too late: the browser has been told by then. Returns whether anything changed.
KaimonSlate.NotebookServer.SlateHistory.relocate! Method
Move a document's store to a new key (a no-op when the source is absent or the target exists).
KaimonSlate.NotebookServer.SlateHistory.silence! Method
Stop warning doc.path that this document is shared.
KaimonSlate.NotebookServer.SlateHistory.write_side! Method
Write a per-document JSON sidecar. Best effort — losing one must never fail the work that made it.
Report engine
The reactive evaluation core — parsing .jl notebooks, the dependency graph, kernels, cells, binds, and paged tables.
KaimonSlate.ReportEngine Module
ReportEngineSession-side engine for the notebook-like report builder (see PLAN-report-builder.md). This is the engine half of the engine/renderer split (§15.1): it owns the cell/document model, parsing the Literate-style .jl source, and (later) isolated-module evaluation + dependency inference. It runs inside the warm gate session and depends only on light, session-safe packages.
This first slice implements just the model + parse/serialize round-trip — no evaluation yet — so it is testable with Base alone.
KaimonSlate.ReportEngine.FRAME_BINDING Constant
The paused frame's locals, by name, for code that needs the VALUES rather than a summary.
Published into the notebook's namespace under a fixed name so a live watch can reach them from ordinary source text: only the NAMES can go into generated source, since a value has no source form, so the source says u = __dbg_frame[:u] and the value arrives through here at run time. That keeps a frame-scoped watch on the same capture path as any other cell — nothing about plotting or rendering has to know the debugger exists.
KaimonSlate.ReportEngine.SRC_DIGEST_EMPTY Constant
src_tree_digest(dirs) -> UIntA hash of the definitions under dirs. SRC_DIGEST_EMPTY when there is nothing to digest, so the answer is deterministic rather than accidentally zero.
KaimonSlate.ReportEngine.WATCH_CAP Constant
How many samples one watch keeps. A long run must not turn a diagnostic into a memory problem.
KaimonSlate.ReportEngine._NO_AUTO_PRECOMPILE Constant
_replicate_env!(t::RemoteTarget) -> nothingReproduce t.origin_env (the notebook's local project) on the remote at t.project: send it wholesale (Project.toml + Manifest.toml + any /src), send each dev'd dep's source into its copy (_devsrc_path) and rewrite BOTH the Manifest path and Project.toml's [sources] path (Julia ≥1.11 resolves dev deps from the latter) to point there, then instantiate. The Manifest makes registry versions exact and clones git deps from their recorded urls; sending the dev sources makes local checkouts resolve on the host.
KaimonSlate.ReportEngine.Animation Type
A precomputed animation: a quantized frame stack + colormap LUT + a small display manifest.
KaimonSlate.ReportEngine.BindSpec Type
A reactive input widget bound to a variable (@bind name Slider(0:100), §Layer 3).
KaimonSlate.ReportEngine.Cell Type
A single report cell. id is the persistent identity (survives edits/moves); src_hash answers "did the source change". Inference/eval fields are populated later by the dependency + eval passes.
KaimonSlate.ReportEngine.Cell Method
Construct a fresh cell, hashing its source and marking it stale (never-run).
KaimonSlate.ReportEngine.CellOutput Type
Captured result of evaluating a code cell.
KaimonSlate.ReportEngine.DebugEval Type
The answer to evaluating an expression in a paused frame.
KaimonSlate.ReportEngine.DebugFrame Type
One frame in the call stack. src indexes DebugState.sources, or 0 when there is no text for it.
An index rather than the text itself: a recursive stack is the same method twenty times over, and a frame is cheap to send only if its source is sent once.
KaimonSlate.ReportEngine.DebugLocal Type
One variable, summarized.
fresh says the value was produced by THIS session. It is always true of a frame local, which exists only because the frame assigned it, and the question only bites for a cell's module bindings: those survive the last ordinary run, so at the start of a session every one of them already holds a value, and a reader cannot tell last run's answer from this run's. The first specialist to use this pane said so unprompted — it called them "stale values from a previous run" and had to work around the doubt.
KaimonSlate.ReportEngine.DebugMark Type
One armed line: the file as the frame reports it, the line within that file, and an optional predicate that has to hold for it to fire ("" = fire every time).
The predicate is what makes a long run reachable. Instability that starts at step 4,700 cannot be found by stepping 4,700 times, and a line breakpoint inside the loop stops on the first iteration — which is the one that is fine. maximum(abs, du) > 1e3 stops on the one that is not.
enabled is separate from whether the mark exists. Silencing one is not the same act as clearing it, so a disabled mark keeps its line and its predicate, stays listed, and is drawn hollow.
KaimonSlate.ReportEngine.DebugSource Type
The text of one method (or cell), and the line of file its first line is.
Shipped as text because file names a path on the machine the kernel runs on — reading it where the viewer happens to be shows a different file, or none.
KaimonSlate.ReportEngine.DebugState Type
Everything needed to render a paused frame.
Every field is always present. finished says whether the run is over, and when it is, result holds the value and the frame fields are empty rather than absent.
source is the text of the method being executed, with srcfirst the line of file its first line corresponds to. It is shipped rather than read locally because the file is on whichever machine the kernel runs on, which in general is not the one rendering it. It is empty for a frame whose code came from a cell — the server holds the notebook and fills that in, so a remote worker never needs to have been told the notebook's text.
KaimonSlate.ReportEngine.DebugTarget Type
One call the current line makes, and whether stepping into it would land anywhere.
pc is the statement index in the frame's lowered code, and is what the caller picks by. A name cannot identify one: f(g(x), g(y)) calls the same function twice.
interpreted is false for a module the session runs compiled, such as Base or a registered package. Those are still listed; debug_into! admits the module when one is chosen.
KaimonSlate.ReportEngine.DebugTrace Type
What one watch has seen so far, small enough to ride in every state payload.
The series itself can be a hundred thousand samples; that belongs in a chart, and is fetched with debug_traces. These are what a reader decides on — still climbing, or turned, and how far.
hits is passes of the line and n is samples kept. They differ when the expression is not a number, which collects nothing. type is what it last was, so a viewer can say which case it is.
KaimonSlate.ReportEngine.DebugWatch Type
One watched line: sample expr every time file:line runs.
KaimonSlate.ReportEngine.FollowUp Type
One call a tool's reply names as the next step: poll marks the one that tracks the work.
KaimonSlate.ReportEngine.FuncSummary Type
What one notebook function does when it is CALLED, as seen in its body: the globals it reads (refs), assigns through global (writes) and mutates (mut_g), which positional parameters it mutates (mut_p), and the calls it makes with each argument's base name (calls). A cell that calls the function takes these on (build_dependencies!); the cell that defines it does not, since defining a function runs none of its body.
KaimonSlate.ReportEngine.GateKernel Type
GateKernel(project; parent="", envdir="") <: KernelEvaluate cells in a SlateWorker subprocess pinned to the single environment project.
Environment model (fork-and-extend, never LOAD_PATH-stacked):
Base mode (
project == parent): the notebook has no packages of its own, so it runs directly in the enclosingparentproject — zero overhead, exactly like a plain script.Forked mode (
project == envdir): once the notebook adds a package, it gets its OWN env (envdir) seeded from the parent (parent package dev'd in, parent deps + Manifest copied) and resolved as ONE consistent environment — so the notebook can override the base and there are never two versions of a shared dep. Adds never touch the parent.Detached (
parent == ""): no enclosing project; the notebook env is everything.
envdir is the fork target (the per-notebook env dir); parent is recorded for provenance and re-seeding. Lazily spawns + connects on first use (prepare!).
KaimonSlate.ReportEngine.InMemoryPagedProvider Type
Pages/sorts/filters a column-major dataset in-process (the paged form of slate_table).
KaimonSlate.ReportEngine.InProcessKernel Type
InProcessKernel(projectdir = "", envdir = "") <: KernelEvaluate cells in the report's own in-process Module. The namespace lives on report.mod, managed by report_module / reset_module!.
Environment model — the same one GateKernel documents, reached differently:
projectdiris the notebook's enclosing project (""= detached).envdiris the notebook's OWN env, where its package adds land. Created on the first add, so a notebook that adds nothing costs nothing, exactly like the gate path's base mode.
A GateKernel gets those as ONE resolved environment because it owns a worker process to activate it in. In-process there is no such process: the host's active project is the running hub's own, and switching it would repoint the hub underneath itself. So the two directories are layered onto LOAD_PATH instead — notebook env, then enclosing project, then the host env. That is a stack rather than a single resolve, so a package present at two versions is settled by order rather than by Pkg, which is the one way this differs from a worker.
LOAD_PATH is also process-wide, so several notebooks open in one in-process hub share one stack and the most recently opened sits in front. Workers do not have that problem because each owns its own process; here it is the reason a notebook from a different project wants its own slate.
KaimonSlate.ReportEngine.LocalTarget Type
Run the worker on this machine (the default — unchanged behaviour).
KaimonSlate.ReportEngine.MimeChunk Type
One representation of a cell's output (MIME-generic display bundle, §7).
KaimonSlate.ReportEngine.PageRequest Type
A request for one page: 1-based page, sort_col (0 = none), direction, global search.
KaimonSlate.ReportEngine.PageResult Type
One page of rows plus the total row count of the (filtered) result.
KaimonSlate.ReportEngine.PagedProvider Type
A data source that serves pages on demand. Implement page_columns + fetch_page.
KaimonSlate.ReportEngine.PendingKernel Type
PendingKernel <: KernelPlaceholder installed on LiveNotebook.kernel while the real kernel is booting (a worker spawn) or being reconstructed (a standalone bundle's environment). Every dispatched call BLOCKS until _resolve!/_reject! fires, then forwards to the real kernel — so a run/edit request that races the boot window queues transparently instead of silently evaluating in-process against the wrong (extension's own) environment, or erroring on a worker that doesn't exist yet. Mirrors GateKernel's own lock-guarded prepare! (which blocks concurrent callers on a reconnect), generalized to "any kernel op, before the real kernel is known."
KaimonSlate.ReportEngine.ProfOpts Type
How a cell is profiled. mode: cpu (sampled on-CPU time), wall (every task, waiting ones too), alloc (allocations, by bytes) or gpu (cpu plus CUDA.jl's record of the device's work). delay_ms and buffer set the sampler; trace records what compiled during the run and which calls were dispatched at runtime; alloc_rate is the share of allocations recorded.
KaimonSlate.ReportEngine.RemoteTarget Type
RemoteTarget(ssh_host; transport=:tunnel, project="~/.cache/kaimonslate/remote")Run the worker on ssh_host — an SSH target you have ALREADY set up (a Host in ~/.ssh/config, key-based auth). We piggyback on that: no password prompts, no host-key negotiation here. transport is :tunnel (firewall-safe, SSH-encrypted) or :direct (CURVE-encrypted straight dial). project is the remote path the notebook's parent project is provisioned into (kept in sync from local).
KaimonSlate.ReportEngine.Run Type
One computation of one cell, from the runner picking the cell up to its result being merged.
phase is :preparing until the cell is handed to a worker (a region's bring-up, the namespace prime and the input transfer all happen first) and :dispatched after. A pure using cell's run is then :mirroring while the import is replayed on the notebook's other sides. A result is accepted only from the run that is still the cell's (cell.run === run), so a restart, a replaced worker or a superseded edit drops the late answer instead of overwriting newer state.
rerun records that an input changed while the run was in flight: the result is kept and shown, and the cell is left STALE so it runs again. stop_at is when Stop was asked of this run (0 = not asked).
KaimonSlate.ReportEngine.ServerTool Type
A tool the Kaimon server serves: registry name, description and JSON-schema parameters.
KaimonSlate.ReportEngine.SlatePagedTable Type
A captured paged table: the registered provider id, columns, total, and page 1.
KaimonSlate.ReportEngine.SlateTable Type
A captured tabular result: typed columns + JSON-safe row cells, rendered client-side.
KaimonSlate.ReportEngine.SqlPagedProvider Type
Browses a SQL relation with sort/filter/paging pushed into the query (slate_query).
KaimonSlate.ReportEngine.SyncDest Type
One remote copy of a source directory: what it was last sent, and the kernels that load from it.
KaimonSlate.ReportEngine.TermScreen Type
TermScreen()A grid of lines plus a cursor, fed with feed! and read back with screen_text. Retains the whole transcript (every line written), not a fixed-height viewport.
KaimonSlate.ReportEngine.ToolCall Type
ToolCallOne invocation of a session tool: what was called, with what, what came back, and how long it took. Returned by slate_tool and rendered as a panel rather than a string, so the call and its schema stay legible in the document after the fact.
KaimonSlate.ReportEngine.Tunnel Type
Tunnel — a set of local ports carried over the host's session by `direct_tcpip`. No process of
its own, and no connection of its own, so it costs no second authentication.KaimonSlate.ReportEngine._StartProc Type
One process of a worker that did not start: its pid, state, kernel wait, CPU %, age in seconds, files.
KaimonSlate.ReportEngine.FileUpload Method
FileUpload(; accept="", label=nothing, maxbytes=0) -> WidgetA file the READER supplies. The browser sends the bytes to the server, which stores them under the notebook's datadir() and binds an UploadedFile — so downstream cells get a real path and recompute exactly as they would for a moved slider. Before anything is uploaded the value is nothing.
accept is the file-picker filter, in the HTML accept vocabulary (".csv", ".csv,.txt", "text/*"); it is a convenience for the reader, not a guarantee — validate what you actually got. maxbytes rejects anything larger (0 = the server default).
@bind datafile FileUpload(; accept = ".csv", label = "Data")
if datafile === nothing
md"Upload a file to begin."
else
CSV.read(datafile.path, DataFrame)
endKaimonSlate.ReportEngine.Form Method
Form(; submit = "Apply", label = nothing, fields...) -> WidgetSeveral controls that change together, applied at once. Moving a field changes nothing until the form is applied: the cells reading the form run once, with every field's new value, instead of running again for each control as it moves. That suits settings that feed an expensive cell (a campaign, a long simulation), where a reader sets a few of them and then wants one run.
Binds a NamedTuple of the fields' values, each as its own control would bind it (a Choice for a labeled Select, (lo, hi) for a RangeSlider).
@bind costs Form(horizon = Slider(1:10; default = 5, label = "years"),
pump_price = Slider(5_000:5_000:200_000; default = 45_000),
spread = Slider(0.1:0.05:1.0; default = 0.5))
costs.horizon * 8760 # a field by name
horizon, price = costs # or in orderA field may be any control that holds a value; a Button, a FileUpload, a figure pick, a playhead and another Form cannot be fields. set_bind(:costs, (; horizon = 3, …)) applies values from a cell, a field left out taking its default.
KaimonSlate.ReportEngine.PickPath Method
PickPath(; n=3, default=nothing, snap=0, label=nothing) -> WidgetClick n points on a figure, binding them as a Vector of (x, y) in DATA coordinates.
The length is FIXED at n: the reader's clicks fill the path and the next one starts it over. A variable-length path would be a value whose shape changes under the reader, which neither the coercion contract nor a static export's domain can express. Attach it with pick_on!.
KaimonSlate.ReportEngine.PickPoint Method
PickPoint(; default=(0,0), snap=0, snapto=nothing, label=nothing) -> WidgetPick a point by clicking (or dragging) on a figure, binding (x, y) in DATA coordinates.
snap and snapto answer different questions. snap quantises to a lattice, for a continuous quantity read to a given precision. snapto names the points that may be chosen and takes the NEAREST one, so a click always lands on a real candidate instead of on whichever lattice point happens to be closest. Given both, snapto wins, being the more specific statement of the choice.
@bind sensor PickPoint(; snapto = [(s.x, s.y) for s in stations])Attach it to an axis with pick_on! from the cell that builds the figure — the control is declared first and calibrated after, because a figure that draws the pick reads the bind:
@bind p PickPoint(; default = (-0.6, -0.9), snap = 0.05)
fig = Figure(); ax = Axis(fig[1, 1]); heatmap!(ax, xs, ys, Z)
scatter!(ax, [p.x], [p.y]) # the marker follows the bind
pick_on!(:p, fig, ax) # …and the click target follows the axis
figsnap is not cosmetic. A continuous pick has no finite domain, so a static export can render the control but nothing downstream can react to it. Snapping makes the domain a grid, which @replay can enumerate and precompute — so a snapped pick keeps working with no kernel.
KaimonSlate.ReportEngine.PickRegion Method
PickRegion(; default=nothing, snap=0, label=nothing) -> WidgetDrag out a box on a figure, binding (xlo, xhi, ylo, yhi) in DATA coordinates.
The corners are normalised in coercion, so the value never depends on which way the reader dragged. Attach it with pick_on!. A region's domain is not enumerable, so it is a live-only control.
KaimonSlate.ReportEngine.RangeSlider Method
RangeSlider(range; default=nothing, label=nothing) -> Widget
RangeSlider(min, max; step=1, default=nothing, label=nothing) -> WidgetA slider with two thumbs, binding an interval as a (lo, hi) NamedTuple.
For choosing a span — a region of a signal, a date window, an axis limit pair — where the two ends are one decision. Two separate sliders make the reader hold "lo must stay below hi" in their head and let them cross; one control with two thumbs cannot be put into that state.
@bind span RangeSlider(400:4000; default = (1500, 1800), label = "region")
lo, hi = span # destructures
span.lo, span.hi # or by nameKaimonSlate.ReportEngine._add! Method
_add!(acc, frames, start, cur, w) -> IntAdd one stack, frames root first, below node cur, from frames[start] on, with weight w (a sample, or an allocation's bytes). Every node above cur holds it too. The runtime's own frames are not nodes: under a dispatch they mark the line above them, and garbage collection or compilation end the path in a node of their own. Returns the node the path ended in.
KaimonSlate.ReportEngine._alloc_build Method
_alloc_build(cid, task, facts; error, others) -> DictThe allocations a profile recorded (a sampled share of them), as the same line-keyed tree weighted by bytes, with a table of what was allocated: type, count and bytes, scaled back up by the share.
KaimonSlate.ReportEngine._allocation_route Method
_allocation_route(t) -> route | nothingThe route into the allocation that target t was built in: the login host and scheduler of its region, and its job, while the region still holds that job on that node. nothing once the region holds another job or none. The route of the node itself is not used, because it is kept per node, and two regions with allocations on one node share it.
KaimonSlate.ReportEngine._arg_control Method
The control for one parameter: a select where the type enumerates its values, a number field where it is numeric, a text input otherwise. An empty selection means "not supplied", which is how a call omits an optional parameter and lets the tool's own default stand.
KaimonSlate.ReportEngine._arm! Method
Arm every mark and watch, composing the ones that share a line.
JuliaInterpreter keeps ONE breakpoint per statement, so arming a watch and a mark at the same file:line does not give you both — the second silently replaces the first, and whichever lost stops working. That is not hypothetical: a watch on the line a predicate was armed on left the predicate disarmed and the run went to completion without stopping.
So the two are built together. Each line gets a single condition that records every watch on it and then answers with the mark's predicate, which is the behaviour wanted anyway: sample every pass, stop on the pass that matters.
KaimonSlate.ReportEngine._auto_id Method
Deterministic short id from a cell's content + position (used when none given).
KaimonSlate.ReportEngine._binding_value Method
A module binding's current value, as Some(v), or nothing if it is not assigned yet.
invokelatest wraps the WHOLE access, isdefined included. The interpreter creates a global in a newer world than this function was compiled in, so reading it at the stale world says "not defined" for one more step — which showed up as every value in the pane lagging the line that assigned it.
KaimonSlate.ReportEngine._breaks_now Method
Should the run stop where this frame is standing, right now?
_on_breakpoint reads the armed flag of a position already reached, which is enough once debug_command has answered. This is asked before anything runs, so it goes through JuliaInterpreter and evaluates the condition. Evaluating it is also what records the watches armed on that line.
KaimonSlate.ReportEngine._call_server_tool Method
Call a tool on the Kaimon server through its service endpoint. The server resolves the name against its full registry and runs the handler (an extension's in that extension's process), coercing the arguments as it does for an agent's call.
KaimonSlate.ReportEngine._cell_source Method
Emit one cell as a header line plus its body.
KaimonSlate.ReportEngine._classify_start Method
_classify_start(procs) -> (kind, summary, file)Why a worker did not start, from _parse_start_probe: :fs when one of its processes is blocked on a file (uninterruptible, or in a file-system wait), :spin when one is busy (Julia-side: a deadlock or a long compile), :waiting otherwise, :gone when it has no process. file is the file the blocked process holds, when it holds one.
KaimonSlate.ReportEngine._compiles_on_login Method
Whether a prepare of region r compiles on its login node as well as on the node (Machine.compile).
KaimonSlate.ReportEngine._confined_worker Method
_confined_worker(cmd, k) -> CmdA local worker under the host's confinement policy (KAIMON_CONFINE_POLICY, with the launcher in KAIMON_CONFINE; see Kaimon's confine), on Linux: it can read everything but what the policy denies, and write only its notebook's folder, its project, and a depot, cache and temporary directory kept for confined workers (the depot first, for what it compiles and installs, before the ones it reads). Without a policy, or elsewhere, cmd as it is.
KaimonSlate.ReportEngine._curve_start_kwargs Method
The SlateWorker.start keywords that make a spawned worker serve CURVE for client alone ("" ⇒ none).
KaimonSlate.ReportEngine._debug_eval_expr Method
debug_eval_expr(expr) -> DebugEvalEvaluate an expression in the paused frame's scope. The frame's locals are bound first, so a probe sees exactly what the code sees at that line.
KaimonSlate.ReportEngine._debug_frame Method
Current state without advancing.
KaimonSlate.ReportEngine._debug_frame_locals! Method
debug_frame_locals!() -> Vector{String}Publish the paused frame's locals into the namespace and answer which names are available.
Called before a live watch runs, so the watch's generated let binds names that exist. A name that has gone out of scope simply stops being offered rather than becoming a stale value.
KaimonSlate.ReportEngine._debug_interpret! Method
debug_interpret!(; admit, drop) -> DebugStateAdd or remove a module from the set this session steps rather than runs compiled.
Admitting a module is how to get inside a library. Dropping it again matters because every line steps while it is in the set, which is slow and fills the call stack with that module's internals.
The cell's own namespace cannot be dropped. It is the code being stepped.
KaimonSlate.ReportEngine._debug_into! Method
debug_into!(; pc, admit) -> DebugStateStep into the call at lowered statement pc. pc <= 0 is a plain into.
admit names a module to start interpreting first, which is how to get inside a library the session was running compiled. It holds until debug_interpret! drops it, and the state's interpreting list reports it.
Reaching the chosen call means running the ones before it. Those run COMPILED whatever the interpret set says, or picking the second call on a line would land in the first.
KaimonSlate.ReportEngine._debug_into_targets Method
debug_into_targets() -> Vector{DebugTarget}The calls the line under the cursor still has to make, in the order it will make them.
Only the statements from the current position on, since a call already evaluated cannot be stepped into. Core and the builtins are left out; a lowered line is full of them.
KaimonSlate.ReportEngine._debug_marks! Method
debug_marks!(; mark_files, mark_lines) -> DebugStateReplace the session's breakpoints with exactly this set, without advancing. Answers with the current state so a caller gets one shape back from every verb.
KaimonSlate.ReportEngine._debug_start! Method
debug_start!(ns; cell = cell, source = source) -> DebugStateBuild a frame for the cell's code without running it. Returns the state before the first line executes, so the caller sees the starting point rather than a result.
KaimonSlate.ReportEngine._debug_step! Method
debug_step!(mode) -> DebugStatenext stays in this frame, into descends into an interpreted call, out finishes the current frame, continue runs the rest of the cell.
KaimonSlate.ReportEngine._debug_stop! Method
Abandon the session and put the interpreter's scope and breakpoint list back the way they were.
KaimonSlate.ReportEngine._debug_traces Method
The samples each watched expression has collected so far — the full series, for plotting.
KaimonSlate.ReportEngine._debug_watch! Method
debug_watch!(; watch_files, watch_lines, watch_exprs) -> DebugStateReplace the watched expressions. Existing traces for an expression that is still watched are kept, so adding a second watch mid-run does not discard what the first has already collected.
KaimonSlate.ReportEngine._diagnose_start Method
_diagnose_start(host, port) -> (kind, summary, file)Read why worker port on host has not opened its port, log it, and return it (_classify_start). A busy worker is sent SIGUSR1 once, which makes Julia write every thread's stack to its log.
KaimonSlate.ReportEngine._do_bind_observable Method
_do_bind_observable(reg, reglock, listeners, cleanup, name) -> ObservableA control's value as an Observable, for a cell that wants to CONSUME the control reactively rather than be recomputed by it — a Makie figure that should update in place instead of being rebuilt on every drag.
The Observable is deliberately cell-local: a fresh one per run, seeded from the registry and fed by a listener that slate_on_cleanup drops when the cell re-runs. That is what makes the usual lift/map on top of it safe. A notebook-lifetime Observable would keep every derived value its readers ever attached — and a session-bound figure cell re-runs on every browser connect, so those accumulate without bound, holding a whole Figure and its GPU buffers each time. Handing back something that dies with the cell makes that leak unwritable rather than documented.
KaimonSlate.ReportEngine._do_on_bind Method
_do_on_bind(listeners, name, f) -> unregisterRegister f to run with the control's new value on every change. Returns a thunk that removes it.
KaimonSlate.ReportEngine._download_button Method
download_button(name, data; label=nothing, mime="") -> HTML
download_button(ref::AssetRef; label=nothing) -> HTMLA button that saves a generated result to the reader's disk. name is the filename they get.
Reading a table on screen is not the same as leaving with it. A notebook author can always tell someone to copy the output, but an app's reader has no cell to run and no filesystem to look in — so anything they are meant to keep needs an explicit way out. This is that way out: data goes through save_asset, and the button hands the reader those exact bytes.
data is whatever save_asset accepts (a String, Vector{UInt8}, numeric array, or a JSON-able value); pass mime when the extension doesn't imply it. Works live, in a standalone export, and on a published page — the export inlines the bytes, so a frozen page still downloads.
io = IOBuffer(); CSV.write(io, results)
download_button("results.csv", String(take!(io)); label = "Download the results")KaimonSlate.ReportEngine._error_state Method
A terminal state carrying only an explanation — same shape as any other, so a viewer renders it without a special case.
KaimonSlate.ReportEngine._expand_cell_statements Method
Expand src's top-level statements in mod (recursively, NEVER evaluating) → the expanded exprs, or none at all if any statement fails to expand. A macro may return Expr(:toplevel, …) (@enum does) whose sub-statements still carry unresolved hygienic-scope nodes — re-expanding each one resolves them. A top-level literal include is replaced by the included file's own statements first (_splice_includes).
KaimonSlate.ReportEngine._expanded_bindings_of Method
ExpressionExplorer analysis of expanded statements → (reads, writes)::Tuple{Set{Symbol},Set{Symbol}}, or nothing (nothing expanded / analysis threw → the caller keeps its conservative scan). ee is the ExpressionExplorer module — each side passes its own import, same pinned version. Hygiene: gensyms ('#' anywhere) and EE's synthetic anonymous-fn names are never notebook bindings and are dropped; a qualified ref on the raw AST surfaces as its ROOT symbol (:Base) — a harmless extra read (no cell ever writes Base), so it passes through.
KaimonSlate.ReportEngine._failure_of Method
_failure_of(out, n) -> StringWhat a failed run's output says went wrong, at most n characters: from its first ERROR line, where Julia and Pkg report it after everything they printed on the way, or else the output's end.
KaimonSlate.ReportEngine._files_under Method
_files_under(dir; descend = _ -> true) -> Vector{String}Every file under dir, as a path relative to it with / separators, in sorted order, without entering a directory descend(rel) refuses or one that cannot be read. walkdir cannot be pruned: it iterates the list of directories it hands out while the caller runs, so editing that list races its own traversal and can skip a directory, depending on scheduling.
KaimonSlate.ReportEngine._followups Method
Every backticked call a result advertises, in the order stated, deduplicated.
KaimonSlate.ReportEngine._forget_cell! Method
Delete the methods a removed cell defined and forget it. Returns the number deleted.
KaimonSlate.ReportEngine._frame_source Method
The text of the method this frame is running, and the line file numbers its first line as — ("", 0) when there is none to give.
Shipped as text on purpose. file names a path on the machine the kernel runs on; reading it where the viewer happens to be would show a different file, or none. The lookup goes through CodeTracking (Revise's own record of where definitions came from), so a method from a dev'd package that has been edited since it loaded reports the source that is actually running.
KaimonSlate.ReportEngine._frame_stack Method
The frame stack, outermost first, together with the source of every frame in it.
Every frame gets its text, not just the innermost one: "why was this called with that?" is a question about the CALLER, and answering it from a line number alone means reading the file by hand on whichever machine it lives on. Sources are pooled and referenced by index, so a recursive stack costs one copy, and the pool is capped — a runaway recursion should not turn one step into a megabyte.
KaimonSlate.ReportEngine._free_local_port Method
An OS-assigned free local TCP port (bind :0, read it, release — small race window).
KaimonSlate.ReportEngine._gate_transfer Method
_gate_transfer(localdir, region, excludes)Report what is about to be sent, and REFUSE to send it when it is large and nobody has said what should stay behind.
Advisory was not enough. The cost of a provision is paid before anyone sees a number — the first run on a region is the slow one — so a panel that opens while the transfer proceeds anyway informs the user of something they can no longer prevent. This stops, and the run says why.
It only ever fires when there are NO rules for the project: writing them, or recording that everything is meant to travel, answers it permanently. transfer_warn_mb = 0 turns it off.
KaimonSlate.ReportEngine._granted_ts Method
_granted_ts(prev, host, job, now_) -> Float64When the node we are now holding was GRANTED. The same node and job carried over from the previous placement keep their original stamp; anything else is a new grant and starts now.
Two different clocks used to share one field. _PLACE_TTL re-asks the scheduler every few seconds and rewrote ts each time, while the idle timer reads ts as the floor on how long the node can have been idle — so a held node looked freshly granted forever and the idle timeout could never mature. checked is the refresh stamp now; this is the grant.
KaimonSlate.ReportEngine._graphics_export_names Method
Union of exports of every RESOLVED Makie-family module (empty until one resolves). Compute once per pass and reuse — don't call per cell.
KaimonSlate.ReportEngine._incomplete Method
The parser's complaint about code it could not read anywhere in ex, or nothing.
KaimonSlate.ReportEngine._interpret_find Method
A module already in this session's interpret set, matched by short or full name.
KaimonSlate.ReportEngine._interpret_set Method
Modules whose code is stepped rather than run compiled.
Everything else in the session runs at native speed. The set is the cell's own namespace plus whatever Revise is already tracking, which is exactly the code the user is working on. That is the whole of the configuration: the equivalent feature elsewhere asks you to predict, up front, which modules you will care about, and then punishes a wrong guess with breakpoints that never fire.
KaimonSlate.ReportEngine._is_definition_stmt Method
_is_definition_stmt(s) -> BoolA top-level statement that DEFINES something rather than computing it: a function (long or short form, possibly docstring- or @inline-wrapped), a global bound to an anonymous function, a type, a macro, or a const bound to a literal. Such a statement is self-sufficient, establishing a name without consuming another cell's data, so it can be replayed on another namespace or after a cache restore. A const bound to an EXPRESSION does not qualify: const N = size(data, 1) reads upstream data and is compute, not definition.
A definition may still REFERENCE a global in its body (f(x) = x * SCALE); Julia resolves it at call time, so the definition stands on its own.
KaimonSlate.ReportEngine._is_graphics_cell Method
True when c touches Makie's shared global state: lexical match, or provenance — any of its reads/provides is an export of a resolved Makie-family module.
KaimonSlate.ReportEngine._is_md_line Method
True for a Literate-style markdown line: # alone or # … (hash + space).
KaimonSlate.ReportEngine._is_user_source Method
Source the user could plausibly be editing.
Revise watches far more than you are working on, stdlibs included, and interpreting Compiler or REPL because Revise happens to track them makes stepping slow and the call stack unreadable. Registered packages live in a read-only depot and stdlibs ship with Julia; anything outside both is either a dev'd package or the project's own source.
KaimonSlate.ReportEngine._literal_include_path Method
The path of an include("literal") call, else nothing. Shared by the dependency analyzer — the path is a tracked cell INPUT, exactly like @asset — and by the splice below. A COMPUTED path is invisible to both, the same dynamic caveat readfile carries.
KaimonSlate.ReportEngine._local_curve_keys Method
(client, server) CURVE public keys for a locally spawned worker, or nothing if either is unavailable.
KaimonSlate.ReportEngine._local_summary Method
One local, summarized.
Values are never sent: a frame on a compute node may hold tens of gigabytes, and the point of building this against a remote region first was to make that impossible to forget. The summary carries what a reader needs to decide whether to ask for more.
KaimonSlate.ReportEngine._mark_cond_error Method
Does this predicate parse? Reported at arm time, since a broken one is silent afterwards.
KaimonSlate.ReportEngine._mark_condition Method
Compile a mark's predicate into the form JuliaInterpreter wants, or nothing for an unconditional one.
Paired with the session's namespace rather than left bare: a bare Expr is resolved in Main (JuliaInterpreter._unpack), where a notebook's own bindings do not exist. The frame's locals come from the frame either way.
Wrapped so it cannot throw or return a non-Bool. The predicate runs on EVERY execution of that line, and shouldbreak asserts ::Bool on the result, so an expression that errors on some iteration would abort the run rather than decline to stop — which is worse than not firing. A predicate that never holds is the cost of that, hence the parse check at arm time below.
KaimonSlate.ReportEngine._markdown_source Method
The markdown text of md, with the escapes that keep its text literal for a CommonMark reader. Constructs that CommonMark does not read (a footnote) print as Markdown.plain prints them.
KaimonSlate.ReportEngine._merge_manifests Method
_merge_manifests(nbproj, nbman, refproj, refman) -> (project, manifest) | reasonThe notebook's environment with the reference's packages added: its Project with the reference's direct dependencies, its Manifest with the reference's entries it lacks. Each side was resolved whole, so the result is one a resolve could have produced when the two agree on every package both hold and neither holds a weak dependency only the other has. Otherwise the reason, as a phrase.
KaimonSlate.ReportEngine._module_bindings Method
The cell's own module-level bindings, summarized like locals.
A cell's top-level assignments become globals of the notebook's namespace, not locals of the frame, so without this the pane is empty for exactly the frame a reader starts on. Both the names the cell declares and anything else that appeared in the namespace since the session began; a declared name that has not been assigned yet is reported with an empty type, which is how a viewer tells "waiting" from "assigned nothing".
KaimonSlate.ReportEngine._module_by_name Method
A loaded module by its printed name (Base, MyPkg, Main.NB), or nothing.
KaimonSlate.ReportEngine._on_breakpoint Method
Is the frame sitting on a breakpoint someone armed?
Asked of the frame rather than read off debug_command's return, which hands back a BreakpointRef for its own reasons too — stepping INTO a call is implemented as a synthetic one, so trusting that reported a breakpoint on every into.
KaimonSlate.ReportEngine._parse_header Method
Parse a header line's trailing tokens into (kind, id, controls, tags::Vector{Symbol}). Every token that isn't id=/controls=/code/md becomes a tag flag (known ones drive behaviour; the rest are free-form metadata that round-trips).
KaimonSlate.ReportEngine._pkg_apply Method
_pkg_apply(op, name) -> Dict("ok", "message")Add, update or remove package(s) in the active project. op is "add", "update" or "rm". name is one spec, or several separated by whitespace/commas, all applied in a single resolve (one precompile). An add-spec may be a registry name (Foo or Foo@1.2), a git URL (https://…[.git][#rev], git@…) → Pkg.add(url=…), or a LOCAL path (/…, ~/…, ./…, or an existing dir) → Pkg.develop(path=…), so it's a dev'd dep, hot-reloadable and carried to remote workers.
KaimonSlate.ReportEngine._pkg_parent_now Method
_pkg_parent_now(op, tokens, parent) -> Dict("ok", "message")_pkg_apply_now against the notebook's parent project at parent, then back in the notebook's env, which is re-resolved so it picks up the change (the fork dev-refs the parent, so a resolve pulls it through). The active project is restored even on error.
KaimonSlate.ReportEngine._profile_build Method
_profile_build(cid, task, facts; error, others, marks) -> DictTurn the sample buffer into the line-keyed tree for cell cid, whose evaluation ran on task.
Which samples are the cell's: those of its task, and those of any other task that is not another cell's (others), not the worker's own, and not a thread waiting for work. Work the cell hands to other tasks belongs under the call that handed it out; a task waiting on that work leaves no samples, so it goes where the cell's task last was in the same statement (inside the @threads loop, the fetch), or else on the statement's line, which marks give by buffer position: the buffer fills in the order samples are taken. In wall-time mode a waiting task is sampled too, and its waiting is time like any other.
KaimonSlate.ReportEngine._project_deps Method
The active project's direct dependencies as {name, version, uuid, source, origin} (for eager docs auto-index + the package viewer). source = "registry" | "path" (a dev'd local checkout) | "git" (added from a URL); origin carries the path or url#rev for the non-registry ones — so the UI can flag that a dep points at something machine-specific rather than a pinned registry release. strict = true throws when the environment can't be read (a manifest out of step with its project) instead of answering with an empty list.
KaimonSlate.ReportEngine._qualify_followup Function
A follow-up a reply names is usually bare (job_status) even when the tool that replied is an extension's (fusionkb.ingest), because the tool does not know the namespace it is served under. Resolve a bare name the server does not know to the replying tool's namespace.
KaimonSlate.ReportEngine._redefine_cell! Method
_redefine_cell!(mod, cid, source) -> IntDelete the methods this cell defined last time, before it defines them again from source. A renamed or re-signatured method would otherwise survive the edit that removed it. Returns the number of methods deleted.
KaimonSlate.ReportEngine._region_holds_node Method
Whether this hub has a node placed for the region — purely local, no round trip.
KaimonSlate.ReportEngine._register_invoke! Method
Register the panel's call-back path and return its channel ("" when there is nowhere to register, which renders an inert panel).
The browser calls back on this channel with the edited parameters, so re-running a tool never needs the CELL to re-run, which matters because a cell re-run would also re-execute everything downstream of it. One handler serves the panel's whole surface: Invoke re-fires this tool, and a follow-up button fires the tool the reply named by passing __tool, so a tracked run stays on the channel the cell already registered.
KaimonSlate.ReportEngine._registry_add Method
Install a package registry into this process's depot. It runs in the kernel rather than the hub because a notebook on a remote region resolves against the remote depot. Idempotent: an already-installed registry (matched by url or by name) reports success without touching anything. Returns {ok, message}.
KaimonSlate.ReportEngine._reject! Method
Unblock every waiter on k with a boot failure — forwarded calls raise err instead of hanging forever.
KaimonSlate.ReportEngine._replay_plan Method
_replay_plan(src; filename = "none") -> (; stmts, idx, names)Which of a cell's statements re-establish its definitions on a cache restore, and the globals they bind, so a memo entry stores everything else. stmts are the flattened top-level statements with their line nodes; idx indexes the ones to replay, in source order:
definition statements (
_is_definition_stmt), including those inside a top-levelbegin;a top-level
letthat defines a global function and computes nothing (_definitional_let), replayed whole, since the function may close over the block's locals;name = let … endwhose value is a function, under the same condition.
The hub and the worker both call this, so the entry's contents and the restore agree. A restore parses under the cell's cell:<id> name, as its run does, so the methods it defines are the cell's.
KaimonSlate.ReportEngine._resolve! Method
Unblock every waiter on k — subsequent (and in-flight) calls forward to real.
KaimonSlate.ReportEngine._resolve_callee Function
The function a lowered value refers to, or nothing if it cannot be known without running.
code is the statement list, because the callee is often not written in the call. Lowering a top-level statement resolves each global in a statement of its own and then calls the result, so f(x, a) becomes a GlobalRef statement followed by (%4)(%5, a). Reading only the call gives an SSA reference to a statement that has not run yet. Calls that lowering generates for itself keep their GlobalRef inline, so those resolve directly.
KaimonSlate.ReportEngine._same_registry Method
_same_registry(reg, url) -> BoolDoes an installed registry point at url? Compared on repo, which is the only field carrying it: a RegistryInstance has NO url field, and reading one throws a FieldError that surfaces to the user as "could not add the registry". That failure appears only on a machine which does not already have the registry — precisely the machine the add path exists for.
Trailing .git, a trailing slash and case are all ignored, so the spelling a user pastes matches.
KaimonSlate.ReportEngine._save_asset Method
save_asset(name, data; mime="", dtype=nothing) -> AssetRefRegister data as a named front-end asset produced by this cell — the write-side dual of @asset. Returns an AssetRef that interpolates to a stable, page-local path; load it client-side with Slate.asset(ref). Handles Julia values by type:
a numeric array/matrix → packed as raw column-major binary +
{dtype, shape, order}, so a client reads it straight into aFloat32Array(Slate.assetyields{data, dtype, shape, order}).dtype=downcasts (e.g.dtype=Float32);a
String→ raw text, aVector{UInt8}→ raw bytes (givemime=);any other value (Dict, NamedTuple, …) → JSON (encoded server-side; must be JSON-able).
The bytes ride with the cell's memo, are served live, and are inlined (standalone) or published as a sibling (site) — so a widget/chart works live, offline, and hosted alike.
KaimonSlate.ReportEngine._scope_interpreter! Method
Point the interpreter at keep only; returns the previous set so it can be restored.
KaimonSlate.ReportEngine._server_tool_meta Method
The panel's parameter rows for a server tool, in the shape the gate's own reflection produces, read off its JSON schema. The schema carries JSON types only, so kind is what the controls get.
KaimonSlate.ReportEngine._server_tools Method
Every tool the Kaimon server serves, or an empty vector when there is no gate or no server.
KaimonSlate.ReportEngine._session_tools Method
Every gate tool registered in this session, or an empty vector when no gate is loaded.
KaimonSlate.ReportEngine._set_marks! Method
Arm exactly marks and nothing else.
Applied to already-compiled code immediately and to anything compiled later, so a breakpoint inside a function the cell has not called yet still fires when it does.
KaimonSlate.ReportEngine._set_watches! Method
Arm exactly watches, replacing whatever was set.
A watch is a breakpoint whose predicate has a side effect and then declines to stop. The predicate runs in the frame at every execution of its line, which is precisely the sampling point wanted, and returning false means the run never pauses. So this needs no interpreter machinery of its own beyond what a conditional breakpoint already uses.
KaimonSlate.ReportEngine._since Method
Bytes appended since offset from, as (text, new_offset), WITHOUT consuming them (the cell keeps writing after this returns). Slicing at a byte offset can split a multi-byte character; that is safe here because the only consumer is feed!, which holds a partial character back until it completes.
KaimonSlate.ReportEngine._slate_json Method
Minimal stdlib-only JSON encoding of a value, safe to embed inside a <script>.
KaimonSlate.ReportEngine._splice_includes Function
include("f.jl") → the file's top-level statements, spliced in where the call stood (recursively, for a helper that includes another). The file is PARSED, never evaluated; the point is that what it DEFINES becomes the cell's writes, so cells using those names get real graph edges — the static pass sees only a call to include. Depth-capped and cycle-guarded, and anything unresolvable (missing file, syntax error, computed path) leaves the statement as it stands: a precision loss, never a wrong edge.
KaimonSlate.ReportEngine._ssa_id Method
An SSA reference's statement index, whoever's SSAValue type it is, or nothing.
KaimonSlate.ReportEngine._ssh_reachable Method
Is there an authenticated session for host? Never opens one.
KaimonSlate.ReportEngine._start_held Method
Why starts on host are held, or nothing.
KaimonSlate.ReportEngine._static_check Method
_static_check(f, tt, cellfile; mod, source) -> DictJET's report_opt of f at tt, as one finding per line of the reader's own code (this cell, another cell, a package being worked on). Each report is placed at the innermost frame of its call chain in that code, which is where a fix would go. A report inside a library, reached from the line, is counted there as lib with the call it ends in: code that passes Any around makes many of those, and they are the line's consequence rather than separate problems.
KaimonSlate.ReportEngine._stmt_callee Method
The function a lowered statement calls, or nothing if it is not a call or cannot be resolved.
KaimonSlate.ReportEngine._strip_blank_edges Method
Trim a leading and trailing run of blank lines, preserving interior blanks.
KaimonSlate.ReportEngine._strip_md Method
Strip the # / # prefix from a Literate markdown line.
KaimonSlate.ReportEngine._takeall! Method
The final contents, consumed.
KaimonSlate.ReportEngine._tool_expand Method
_tool_expand(ex) -> ExprRewrite @tool name(arg = value, …) into slate_tool("name"; arg = value, …).
A plain function rather than the macro itself, because the macro is built INSIDE each notebook namespace by _populate_notebook_ns! (the same shape @trace uses), so the transform has to be callable from there.
It emits STRING-keyed pairs rather than keyword syntax. The macro is built inside each notebook module, so Julia's hygiene pass qualifies every un-escaped symbol it returns to that module, and a keyword NAME cannot survive that: run_id = x comes out as (thismodule).run_id = x, which does not parse. A name cannot be escaped either, since that asks for its value. Passing the arguments as ["run_id" => x] sidesteps hygiene entirely, because a string is not a symbol.
KaimonSlate.ReportEngine._tool_meta Method
Reflected metadata for one tool: its description and full declared parameter list.
KaimonSlate.ReportEngine._toplevel_writes Method
The names a cell assigns at top level.
Collected from the parse rather than from the namespace, so a binding appears in the pane before the line that assigns it has run — the point of stepping is to watch it arrive. Deliberately shallow: the fixed points are the cell's own statements, and a global written from inside a loop body still turns up through the namespace diff.
KaimonSlate.ReportEngine._trace_summaries Method
Per-watch summaries for a state payload, in the order the watches were declared.
KaimonSlate.ReportEngine._unbind_globals! Method
_unbind_globals!(mod, names) -> Vector{Symbol}Remove globals that no cell defines any more, so reading one throws UndefVarError the way a fresh run would, instead of serving the value of a deleted or renamed definition. Only bindings the namespace owns are removed; an imported name, and a name the namespace was born with (__slate_prelude, such as echart), are left alone. A no-op on a Julia without Base.delete_binding.
KaimonSlate.ReportEngine._watch_push! Method
Record one sample, from inside a running frame.
Reached by VALUE from the compiled predicate rather than by name: the predicate is evaluated in the notebook's namespace, where this function is not in scope under any name, and interpolating the function object sidesteps the question entirely.
Non-numbers are skipped rather than stored: a trace is for plotting, and the question a watch answers ("what has this been") is a numeric one. Anything that throws is skipped too — a watch must never be able to break the run it is observing.
The pass is counted and the type recorded either way, so an empty trace can be reported as the wrong kind of value rather than as a line the run has not reached. Only the type is kept. Holding the value would pin an array the run has finished with.
KaimonSlate.ReportEngine.animate Method
animate(frames; kind=:heatmap, fps=30, colormap=:auto, clim=:global, transform=nothing,
dither=true, bits=8, x=nothing, y=nothing, title="", colorbar=true,
loop=true, autoplay=false, overlay=nothing, maxbytes=128_000_000,
height=nothing, width=nothing, maxheight=560) -> AnimationPrecompute a stack of frames ONCE, then play it back entirely in the browser on a WebGL canvas — nothing touches Julia during playback, so a slow simulation still plays at 60 fps. The heavy compute is yours and runs once; animate only quantizes + packages.
kind=:heatmap (default) takes a vector of 2-D scalar matrices, colormapped via colormap/clim, where clim is :global (comparable frames) | :symmetric (signed fields → diverging map; skips transform) | :perframe | (lo, hi). kind=:image takes real color frames — a vector of H×W color matrices (e.g. Matrix{RGB} from VideoIO.jl/Images.jl) or H×W×3 arrays — played back true color, no colormap.
height / width set the player's displayed size in CSS pixels, preserving the frame aspect and never exceeding the cell width; give either one and the other follows. Without them the canvas takes the full cell width and derives its height from the aspect, which is why maxheight (560 px) caps it: a frame stack taller than it is wide would otherwise render as a wall.
overlay (either kind) draws frame-synced markers on top: a vector with one entry per frame, each a list of (x, y[, id]) points in frame pixel space; id keeps a point's color/trail stable across frames, e.g. a tracked object's identity. Pair with playhead to react to the current frame.
frames = [density(t) for t in times] # heavy compute, once (cache it)
animate(frames; clim=:symmetric, x=r, y=r, title="ψ(t)", autoplay=true)
vidframes = [read(reader) for _ in 1:n] # Matrix{RGB{N0f8}} from VideoIO.jl
tracks = [[(x1,y1,1), (x2,y2,2)] for _ in 1:n] # per-frame (x,y,id) detections
animate(vidframes; kind=:image, overlay=tracks, fps=25, title="tracked beetles")KaimonSlate.ReportEngine.animate Method
animate(f, nframes; …) — generate frame i with f(i) (sugar for animate([f(i) for i in 1:n])).
KaimonSlate.ReportEngine.assign_bind! Method
Set a @bind control's value from the browser: coerce it against the widget, update the per-notebook registry (so a later re-run preserves it), and assign the global so readers see it. Returns the coerced value. Routed through the namespace's injected __slate_set_bind so the logic lives in exactly one place (widgets.jl).
KaimonSlate.ReportEngine.attach_gate_kernel Method
attach_gate_kernel(port, stream_port; project=".") -> GateKernelA kernel bound to an ALREADY-RUNNING SlateWorker reachable at 127.0.0.1:port (+ stream_port) — e.g. a worker on another machine forwarded here over an SSH tunnel (ssh -N -L port:localhost:port -L stream:localhost:stream host). prepare! CONNECTS instead of spawning: no local process, no env reconstruction — the worker owns its process + environment. The transport is unchanged (the hub always connects to 127.0.0.1:port), so the tunnel is transparent. Remote execution for a notebook is then: start the worker there, forward the two ports, hand the notebook this kernel.
KaimonSlate.ReportEngine.axis_calibration Method
axis_calibration(figure, axis) -> DictThe mapping from a rendered figure's pixels to ONE axis's data coordinates: where the axis sits in the image, what data range it spans, and how each coordinate is scaled.
Duck-typed on the axis rather than typed against Makie, so this file keeps no plotting dependency. Everything comes from the axis itself, so the mapping is exact rather than assumed — in particular scene.viewport is the PLOTTED area, so an aspect = DataAspect() axis that letterboxes inside its layout cell is already accounted for. An axis with no finallimits (a PolarAxis, an Axis3) cannot be mapped by a rectangle and is refused.
KaimonSlate.ReportEngine.bind_owner Method
bind_owner(report, name) -> StringThe id of the cell that DECLARES @bind name, or "" if none does.
Cell code driving a control (set_bind(:name, value)) names only the VARIABLE — a notebook shouldn't have to know which of its own cells happens to hold a control in order to move it. The browser and the agent both already carry the cell id; this is how the third caller finds it.
KaimonSlate.ReportEngine.build_dependencies! Method
build_dependencies!(report) -> reportRe-infer bindings and compute each code cell's upstream deps (ids). A cell depends on the most recent prior writer of each name it reads, plus any earlier cells its needs= tag names (user-asserted effect edges). An :opaque cell depends on all prior code cells, and all later code cells depend on it (barrier).
KaimonSlate.ReportEngine.build_sysimage! Method
build_sysimage!(r, t::RemoteTarget, host; prologue = "", force = false) -> (status, detail, measured)Build region r's worker sysimage on host (a granted node, or the host itself), in the shell its workers start in (the machine's setup, then prologue), for the notebook environment t names, and wait for it. The image holds what the region lists, or the notebook's registered packages when it lists nothing, with Slate's worker packages. The outcome as a prepare step: ok when the image is current or was built, warn when the build was put off or skipped (workers then start without one), fail when it failed; measured is the record a launch decides by (sysimage_plan).
KaimonSlate.ReportEngine.callout! Method
callout!(ax, (x, y), label; offset = (40, 40), color = :white, fontsize = 26) -> plots
callout!(ax3, (x, y, z), label; …)A label pinned to a point of the data: a dot, a fine leader line, and the label offset pixels away. The label may be math: callout!(ax, pt, L"W^u"). The leader keeps its length on screen as the axis zooms, and on an Axis3 follows the point as the camera turns. Returns its plots, so a step can show it.
KaimonSlate.ReportEngine.cancel_cells Method
cancel_cells(kernel, report, ids) -> IntBest-effort interrupt of the named cells' IN-FLIGHT evaluator tasks (superseded-edit preemption — see _preempt_superseded!). Never a correctness dependency: the src-hash version guard still discards a stale result on completion. In-process evals are synchronous with their caller — nothing to preempt — so the base method no-ops; the gate kernel forwards to its worker.
KaimonSlate.ReportEngine.cell_attrs Method
cell_attrs(cell) -> Dict{String,String}A cell's key=value header tokens, read back as attributes.
_parse_header keeps any token it does not recognise as a free-form tag symbol, which is how one round-trips through the .jl with no schema to maintain. Read as a dict they become the cell's CONFIGURATION — the settings that belong to the cell rather than to its code:
#%% job id=scan walltime=02:00:00 partition=gpu mem=16GA batch sweep is the case that needs this. Walltime, memory and partition are the settings you change WHILE a job is queued or after it was killed, and burying them in a Julia keyword argument means editing source (and re-running the cell) to adjust a number that has nothing to do with the computation. On the header they are editable from the notebook UI, and they are deliberately not part of a sweep's key, so raising a walltime resumes the sweep rather than discarding it.
KaimonSlate.ReportEngine.check_project_file Method
check_project_file(projectfile)Throws when the project at projectfile cannot be forked: what Pkg rejects when it reads the file (a [compat] entry naming a package the project does not list, say), or a package listed under the UUID of a differently-named registered package. Run before a fork is seeded from the project, so the error names the project's own file rather than the fork's copy of it.
KaimonSlate.ReportEngine.clear_env_problem! Method
Drop one part (:failure or :left_out) of what is recorded for envdir. Returns whether there was any.
KaimonSlate.ReportEngine.close_staleness! Method
close_staleness!(report)Bring the stale set to the closure the current graph implies, after any rebuild: everything downstream of a stale cell is stale, and a stale cell that updates a value in place has that value's origin cell restaled too, so the update applies to a fresh value instead of stacking on the result of its last run (push!(v, 2) edited to push!(v, 2, 3) must not leave four elements).
The rebuild that recovers a macro's writes runs after the edit has already restaled through the old graph; without this pass the new edges reach no one, and a reader keeps its old value.
KaimonSlate.ReportEngine.cluster_delete! Method
Forget a target. Returns whether one was removed.
KaimonSlate.ReportEngine.cluster_get Method
One target by name, or nothing.
KaimonSlate.ReportEngine.cluster_set! Method
cluster_set!(spec) -> DictAdd or replace a target by its name. The spec is stored as given — the fields a SLURM target needs are not the fields a PBS one does, and a schema here would have to be rewritten for every scheduler.
KaimonSlate.ReportEngine.clusters_all Method
Every named compute target this machine knows, as plain dictionaries (the fields vary by kind).
KaimonSlate.ReportEngine.clusters_resolved Method
clusters_resolved(; tested = true, only = nothing) -> Vector{Dict}Every machine entry with what Julia started there needs added: _setup, the machine's shell (machine_setup), and _depot. Entries go to a notebook's worker this way because a worker has no registry or host facts of its own, and batch tasks it submits must start in the same shell.
tested = false leaves out _tested, the environments ready on each machine's nodes. That is the expensive part, a readiness check of every tested environment, and only a submission reads it. only keeps the one entry of that name.
KaimonSlate.ReportEngine.common_units Method
common_units(num, err, unit) -> (num, err, unit)A number (and its uncertainty) in SI base units, rewritten in the common unit its dimension has, with the SI prefix that puts it between 1 and 1000: ("4.3247e8", "", "m² kg s⁻³") becomes ("432.47", "", "MW"). Returned unchanged when the unit is not in base units or has no name.
KaimonSlate.ReportEngine.common_units_text Method
common_units_text(text) -> StringThe same for a whole quantity's text: "(1.59e9 ± 2.0e7) m² kg s⁻³" becomes "1590.0 ± 20.0 MW". Text that is not a number with a base-unit dimension comes back as it was.
KaimonSlate.ReportEngine.complete Method
complete(kernel, report, code, pos) -> (; items, from, to)Completion candidates for code at byte offset pos, resolved WHERE the kernel's bindings live — so using'd packages and evaluated-cell bindings complete, not just Base. items is a Vector{Tuple{String,String}} of (text, kind); from/to are 0-based byte offsets of the replaced range. The in-process kernel completes locally.
KaimonSlate.ReportEngine.cook_terminal Method
cook_terminal(text) -> StringReplay text's cursor movement and erasure and return what a terminal would be showing. Text with nothing to replay is returned unchanged. SGR is preserved; every other escape sequence is consumed.
KaimonSlate.ReportEngine.crash_report Method
crash_report(log) -> StringJulia's report of a fatal signal in a worker log, cut to what says where it happened: the signal, the cell it was running, and the frames of the code that was running, without Julia's own. "" when the log holds none.
KaimonSlate.ReportEngine.debug_eval_expr Method
debug_eval_expr(kernel, report; expr) -> DebugEvalEvaluate expr in the paused frame's scope, where the values live.
KaimonSlate.ReportEngine.debug_frame Method
The current state without advancing.
KaimonSlate.ReportEngine.debug_frame_locals! Method
debug_frame_locals!(kernel, report) -> Vector{String}Publish the paused frame's locals where ordinary notebook code can reach them, and say which names are there. A live watch wraps its source in a let over exactly these.
KaimonSlate.ReportEngine.debug_interpret! Method
Add or remove a module from the set the session steps rather than runs compiled.
KaimonSlate.ReportEngine.debug_into! Method
debug_into!(kernel, report; pc, admit) -> DebugStateStep into the call at lowered statement pc, admitting module admit to the interpret set first if it is named. pc = 0 is a plain into.
KaimonSlate.ReportEngine.debug_into_targets Method
The calls the current line still has to make, each with the module it would step into.
KaimonSlate.ReportEngine.debug_marks! Method
debug_marks!(kernel, report; mark_files, mark_lines, mark_conds, mark_enabled) -> DebugStateArm exactly these file:line breakpoints on the session, replacing whatever was set. A non-empty mark_conds[i] makes that one fire only when the expression holds in the frame, and a false mark_enabled[i] keeps it in the set without arming it.
KaimonSlate.ReportEngine.debug_start! Method
debug_start!(kernel, report; cell, source) -> DebugStateBegin stepping source (the cell's code) where this kernel's cells evaluate. Returns the state BEFORE the first line runs.
KaimonSlate.ReportEngine.debug_step! Method
debug_step!(kernel, report; mode) -> DebugStateAdvance the session: next | into | out | continue.
KaimonSlate.ReportEngine.debug_stop! Method
Abandon the session and restore the interpreter's scope.
KaimonSlate.ReportEngine.debug_traces Method
Samples collected so far, expression → values in execution order.
KaimonSlate.ReportEngine.debug_watch! Method
debug_watch!(kernel, report; watch_files, watch_lines, watch_exprs) -> DebugStateSample each expression every time its line runs, without stopping. Answers the question a stepper cannot: not what a value is now, but what it has been.
KaimonSlate.ReportEngine.dependents_of Method
dependents_of(report, ids) -> Set{String}Transitive closure: ids plus every cell that (transitively) depends on one of them. This is the staleness blast radius of changing ids.
KaimonSlate.ReportEngine.deps_digest Function
deps_digest(projectfile, exclude = ()) -> UIntHash of every package the notebook's environment loads, as its resolving manifest (_manifest_for) records them, plus the Julia version. It starts from projectfile's direct [deps] minus the names in exclude (Slate's own worker packages) and follows each entry's deps through the manifest, so a package reached only through another one counts, and a package only Slate's worker brings doesn't. Each entry contributes its name, UUID, version, git-tree-sha1 and any path/repo-url/repo-rev. A workspace member reads the shared manifest at the workspace root. UInt(0) when there is no manifest or a file does not parse.
This is what lets the memo key change when the code a cached result came from changes outside the notebook's own source: an upgrade of a dependency of a dependency, or a new Julia.
KaimonSlate.ReportEngine.echart Method
Build an interactive ECharts chart from an option dict.
KaimonSlate.ReportEngine.emit_client! Method
emit_client!(Z, data_endpoint, credit_endpoint, on_message; window, pool) -> EmitClientAttach to a worker's emit channel and start receiving. on_message(kind, buf, release, grant) is called on the receive task for each message, in order: buf is the payload in a buffer from pool. grant() grants the message's size back to the worker, once the message has gone where it is going first. release() must be called exactly once, when buf is no longer needed by anyone: it gives the buffer back, and grants too if grant has not been called. Separating the two lets a consumer that is slow to read hold its copy of the bytes without holding back the worker.
KaimonSlate.ReportEngine.emit_send! Method
emit_send!(s, kind, payload; nbytes = length(payload), wait_s = EMIT_WAIT_S[]) -> SymbolSend one message: :sent, or :detached, when no hub is attached or none granted credit within wait_s (the channel then detaches and asks to resume later), so the caller sends it some other way. Returns once send has copied payload into libzmq, so the caller may reuse it.
KaimonSlate.ReportEngine.emit_server! Method
emit_server!(Z, data_endpoint, credit_endpoint; secret = "") -> EmitServerBind the worker's two emit sockets and start the task that takes the hub's credit. An endpoint may leave the port to the system (tcp://127.0.0.1:*); data_endpoint and credit_endpoint on the result are the bound addresses. With a secret, only a client presenting it can connect. The channel is used only once the hub has attached (emit_attached).
KaimonSlate.ReportEngine.ensure_notebook_file! Method
ensure_notebook_file!(path) -> pathThe file a notebook is opened from, created if it isn't there yet — including the directories leading to it.
Opening a path that doesn't exist has always meant "make me this notebook", and every entry point (the slate.open tool, the CLI, the /api/open route) agreed on that for the FILE while failing on a missing parent. Callers reach for notebooks/<name>.jl in a project that has no notebooks/ yet, and refusing over the directory when we were about to create the file inside it anyway is a distinction without a difference to whoever is on the other end. One definition here so those three can't drift apart on what "open a new path" means.
KaimonSlate.ReportEngine.env_add_code Function
env_add_code(delta, devs = Dict(); base = "") -> StringPkg code that re-adds the notebook's own packages (readd_specs) after a re-seed, for a rebuild that runs in a subprocess. devs (name => path, from fork_devs) are the checkouts the fork had developed. They are read from the fork itself, so for those packages they win over the footer's record. Checkouts are developed first, so a package that depends on one resolves against it.
KaimonSlate.ReportEngine.env_packages Method
The direct packages of project and the versions its manifest resolves them to ("" unresolved). Parsed again only when the project file or its manifest changes.
KaimonSlate.ReportEngine.env_path_deps Method
env_path_deps(parent) -> Vector{Pair{String,String}}Every package [sources] develops into parent by path, transitively, as name => directory. What an environment built from parent somewhere else needs sent along, since no registry can supply it.
KaimonSlate.ReportEngine.env_problem Method
What the last rebuild of envdir could not do, one line each, or "".
KaimonSlate.ReportEngine.env_readiness Method
env_readiness(host, project, nodetype; depot, by) -> String"" when project's environment may start work on host's nodetype nodes, with depot as the depot it would load from; otherwise why not, as a sentence for the Prepare dialog. The machine's site changed since it was prepared; the project never loaded on that kind of node there, or failed to; or its packages, or the depot, changed since it did. With no project, only whether the machine was ever prepared. by, a region's name, is what a project new to the machine is compared with: that region's last prepare on the same kind of node, which is what a notebook that now has an environment of its own was running before.
KaimonSlate.ReportEngine.env_report Method
The machine's record of origin_env's environment on the kind of node region r gets, or nothing.
KaimonSlate.ReportEngine.env_source_dirs Method
env_source_dirs(parent) -> Vector{String}Every source tree whose contents decide what a task computes: parent/src, then the same for each package [sources] devs in, transitively.
KaimonSlate.ReportEngine.env_stale Method
env_stale(envdir, parent) -> BoolA forked env is STALE if the parent has changed since it was seeded (or it was never stamped) — the trigger to rebuild it before booting a worker. Always false when envdir is not a fork (is_fork): a parentless (detached) notebook, or an env that is the parent project itself.
KaimonSlate.ReportEngine.env_work_idle Method
Wait up to timeout seconds for no environment work to be running; whether none is.
KaimonSlate.ReportEngine.eval_capture Function
Evaluate source in the kernel and capture stdout + rich output → CellOutput. region/regions seed the task-local Slate execution context (see _build_slate_ctx); region="" ⇒ the main kernel. lane says which of a worker's thread pools runs it ("ui" for reactive refreshes, see worker.jl _route_request); kernels without lanes ignore it.
KaimonSlate.ReportEngine.eval_report! Method
eval_report!(report; reset=false, kernel=InProcessKernel()) -> ReportEvaluate all code cells in document order through kernel. reset=true does a full rebuild in a fresh namespace first. (No dependency pruning here — that's eval_stale!; this runs every code cell.)
KaimonSlate.ReportEngine.eval_stale! Function
eval_stale!(report, kernel=InProcessKernel()) -> reportEvaluate only STALE code cells, in document order, through kernel. Unchanged (FRESH) cells keep their cached output — their effects already live in the kernel's namespace from the prior eval. (First run: all cells stale ⇒ full eval.)
KaimonSlate.ReportEngine.feed! Method
feed!(screen, chunk) -> screenReplay chunk onto screen. Chunks may split anywhere — a partial escape sequence or UTF-8 character is held back until the bytes that complete it arrive.
KaimonSlate.ReportEngine.fetch_page Function
fetch_page(provider, ::PageRequest) -> PageResult — one page, sorted/filtered/paged.
KaimonSlate.ReportEngine.fetch_remote_worker_log Method
fetch_remote_worker_log(k; maxbytes) -> StringTail the SSH host's own worker-<port>.log (the remote Julia process's stdout/stderr: KaimonGate load, serve() banner, eval output, crashes). This is the factorio-side record — fetched over the same authenticated SSH channel we spawned it on, so it's visible locally in the browser worker-log.
KaimonSlate.ReportEngine.figure_vector Method
figure_vector(cellid) -> Union{Vector{UInt8},Nothing}The PDF of the figure cell cellid last showed, rendered now. nothing when no figure is held for it or the figure has no PDF form. show is called directly rather than gated on showable: CairoMakie answers showable for its active output type only (png by default), yet renders a PDF.
KaimonSlate.ReportEngine.file_defs Method
file_defs(path) -> Dict{String,UInt64}(def-name → body-hash) for one source file. Parsed when the file's size, modification time or inode differs from the last parse, and taken from the last parse otherwise: a digest of a source tree is asked for on a timer, and parsing every file of it each time made the asker a steady stream of allocations.
KaimonSlate.ReportEngine.flush_forget! Method
Apply the report's pending forget! to kernel, if there is any.
KaimonSlate.ReportEngine.footer_origin Function
footer_origin(dir, base = "") -> StringHow the footer records checkout dir: relative to the notebook's project base when it is inside it, so the footer holds wherever the project is cloned; else ~/… under the home directory, for anyone who keeps it at the same place; else as it is. origin_dir reads it back.
KaimonSlate.ReportEngine.forget! Method
Take back removed definitions in the report's in-process namespace (see forget!).
KaimonSlate.ReportEngine.forget! Method
forget!(kernel, report, cells, names)Take back what no cell defines any more, in the namespace where cells run: delete the methods the removed cells defined, and remove the global names no cell writes now, so a reader fails the way a fresh run would instead of using a leftover value. Applied before the next cell runs (see flush_forget!). A no-op for a base kernel.
KaimonSlate.ReportEngine.forget_expansions! Method
forget_expansions!(report, cells) -> nothingDrop the cached expansion bindings of cells so the next graph build re-expands them. The cache is keyed by cell SOURCE, which is the right key for a macro — but an included file's contents are an input the source hash can't see, so a file that gains a definition would keep the old write-set (and the cell using that new name would keep no edge) until the cell itself was edited. The asset watcher calls this for the cells that read a changed file.
KaimonSlate.ReportEngine.fork_devs Method
fork_devs(envdir, parent) -> Dict{String,String}The direct dependencies of the fork at envdir that its Manifest resolves from a local path, by name, with absolute paths. The parent project itself is left out: seeding develops it already. Read before a rebuild re-seeds the fork, which would otherwise swap each of them for a release.
KaimonSlate.ReportEngine.format_changes Method
format_changes(report) -> Vector{String}What updating the notebook to the current file format would change, in words; empty when there is nothing to ask about (a current file, or an older one whose update only stamps the format).
KaimonSlate.ReportEngine.gate_available Method
True when running inside the Kaimon extension (gate client available).
KaimonSlate.ReportEngine.give_buffer! Method
Give buf back to p; dropped when p already holds cap idle buffers.
KaimonSlate.ReportEngine.guarded_prologue Method
guarded_prologue(prologue) -> StringShell that runs prologue and continues past its trailing && only when it succeeds, ready to prefix a command. A prologue that fails stops the command, and says so on stderr with its exit status and its text, which a worker's log then shows. So does a prologue that leaves JULIA_LOAD_PATH set but empty, as unloading the module that set it can: Julia then has no load path at all, and fails to find any package, the worker's own included.
KaimonSlate.ReportEngine.harvest_docs Method
harvest_docs(kernel, report, mod_names) -> Vector{Dict}Harvest {module, name, doc} for documented exported bindings of the named modules, resolved WHERE cells evaluate (so the modules must be using'd in the notebook). The gate kernel forwards to its worker, where the notebook's packages live.
KaimonSlate.ReportEngine.held_conns Method
The connection names of the wires this hub holds to workers no notebook has: parked ones and telemetry watches. Their workers are still running, so their telemetry history is kept.
Method
hidden(w::Widget) -> WidgetMark a control as drawn ELSEWHERE, so Slate renders no chrome for it — no row in its @bind cell, no entry in a surfaced control strip. The control is otherwise completely normal: it holds a value, coerces it, fires @onchange, feeds bind_observable, and appears in a static export's parameters. Only the notebook's own widget is suppressed.
This exists for a control rendered natively inside a figure — a Bonito widget in a WGLMakie scene, say — where a second copy in the notebook would be a confusing duplicate that can drift from the one the reader is actually dragging.
It wraps the widget rather than being a keyword on each constructor, so it works for every widget kind, including third-party ones registered by an extension:
@bind decay hidden(Slider(0.0:0.05:1.5))Marking it at BIND time is deliberate: the widget's params travel to the browser when the @bind cell runs, so a later call could not retract chrome that has already been drawn.
KaimonSlate.ReportEngine.host_facts Method
What preparing found on host; empty when it has not been prepared.
KaimonSlate.ReportEngine.host_facts_merge! Method
Merge kv into what is recorded for host.
KaimonSlate.ReportEngine.host_facts_set! Method
Replace what is recorded for host (an empty dict forgets it).
KaimonSlate.ReportEngine.idle_buffers Method
How many idle buffers p holds.
KaimonSlate.ReportEngine.install_session_hooks! Method
Wire the transport's session-drop announcement to the caches that ride a session. Idempotent.
KaimonSlate.ReportEngine.interpolate Method
interpolate(kernel, report, exprs) -> Vector{CellOutput}Capture each markdown in the kernel (rich output, like a mini code cell). The gate kernel forwards to its worker.
KaimonSlate.ReportEngine.is_fork Method
is_fork(envdir, parent) -> BoolWhether envdir is a forked notebook env of parent: both set and not the same directory. An env that IS its parent (an app installed from a bundle runs in the project it shipped) is never seeded, stamped, or refreshed from it.
Method
Is this control drawn outside the notebook (see hidden)?
KaimonSlate.ReportEngine.is_running Method
Whether a computation of c is in flight.
KaimonSlate.ReportEngine.keep_sgr_only Method
keep_sgr_only(text) -> StringDrop every escape sequence that is not SGR. Cooked text already satisfies this, so it is a defence for text that reached a renderer WITHOUT being cooked — output stored before cooking existed, or a remote worker on an older build — where a raw escape byte would otherwise land in the page.
KaimonSlate.ReportEngine.kernel_connected Method
kernel_connected(kernel) -> BoolCan this kernel be asked anything right now? A worker-backed kernel has no connection while its worker is starting or being reprovisioned; an in-process one is always reachable.
For callers that can answer usefully without the kernel — a read-only panel, a best-effort sync — asking this first is what separates "not yet" from "went wrong". Without it the internal transport error surfaces verbatim, and a UI shows the name of a gate tool to someone who was looking at a cluster.
KaimonSlate.ReportEngine.kernel_stats_conns Method
Every connection with a telemetry series, for the sweep that drops the dead ones.
KaimonSlate.ReportEngine.kind_from_name Method
The kind a word names (md, markdown, code, …), or nothing.
KaimonSlate.ReportEngine.kind_table Method
The kind table as the page reads it: kind name → its capabilities.
KaimonSlate.ReportEngine.last_bringup_line Method
last_bringup_line(; fresh = 45.0) -> StringThe latest bring-up line, or empty if nothing has been said for fresh seconds. The age matters: a worker that drops an hour later is also "not connected", and narrating the last thing a FINISHED provision said would describe a step that is long over as though it were happening.
KaimonSlate.ReportEngine.last_transfer Method
What the last provision to region actually sent, or nothing if none has run this session.
KaimonSlate.ReportEngine.latex_symbol Method
latex_symbol(name) -> StringResolve a LaTeX/emoji completion command ("\alpha", "\:smile:") to its character; "" if unknown. A PARTIAL latex query (\alph) comes back from REPLCompletions as the NAME, not the symbol — so the UI displays the name (it must, to filter by what the user typed) but resolves the symbol via this to APPLY in one step (else accepting inserts the literal \alpha).
KaimonSlate.ReportEngine.left_out_notes Method
The notebook packages a rebuild left out, in words: missing checkouts and records whose name and UUID disagree.
KaimonSlate.ReportEngine.list_remote_workers Method
list_remote_workers(host) -> Vector{Dict}Enumerate the workers Slate has spawned on host, each: port, alive (process running), lastActivity (unix mtime of its log = last computation), logBytes, state/stateSince (lifecycle sidecar: "attached"/"idle" + unix ts; "" for a pre-sidecar worker — advisory, a hub crash leaves a stale "attached"), manifest (raw JSON string — the browser parses it for who/what/when), and stats (the worker's latest 2s telemetry sample: cpu/rss/gc_ms/evals/memo_bytes/ts as raw JSON; "" for a pre-telemetry worker). Reads the on-host manifests over one ssh call. [] if unreachable/none.
KaimonSlate.ReportEngine.machine_depot Method
The depot Julia on machine m uses; "" is the host's default.
KaimonSlate.ReportEngine.machine_get Method
The machine named name, or nothing.
KaimonSlate.ReportEngine.machine_setup Method
machine_setup(m) -> StringThe shell run before any Julia on machine m, ready to prefix a command: the julia to use on PATH, the depot, the module fix preparing found, and the user's prologue. Empty when there is nothing to set.
KaimonSlate.ReportEngine.machine_view Method
machine_view(machine) -> DictA machine for the page: its entry, what preparing found on its host (with the depot in use), the task environments tested on its nodes (by a region or a test task), and any prepare of it running now.
KaimonSlate.ReportEngine.macroexpand_cells Method
macroexpand_cells(kernel, report, srcs) -> Dict{String,Tuple{Set{Symbol},Set{Symbol}}}Macro-expand each cell source (id => source) in the namespace where cells evaluate — recursively, NEVER evaluating — and ANALYZE the expansion there, returning id => (reads, writes). Cells whose expansion/analysis fails are omitted (the caller keeps its conservative static analysis). The gate kernel forwards to its worker, where the notebook's macros are actually defined; only name lists cross the wire (see macroexpand.jl).
KaimonSlate.ReportEngine.mark_blocked! Function
mark_blocked!(c, why, host = "", region = "") -> cThe cell cannot run YET, for a reason that is not its own — a queue that has not granted a node, a host nobody has signed in to. Deliberately NOT mark_errored!: a wait rendered as a failure reads as broken code, and it sends people to fix a cell that is fine.
why is a CODE (queued, not_signed_in), not a sentence: the page words it, next to the chip it is drawn in and the buttons it offers. host is the one detail those words need. region is the region whose node or prepare is awaited, which is what the supervisors act on.
The reason goes on the cell rather than into an output, so the header can show it and the output area keeps whatever the last successful run produced — a cell waiting for a node has not lost the value it had. Cleared by every other transition, so it can never outlive the wait.
KaimonSlate.ReportEngine.memo_keep! Method
memo_keep!(kernel, report, cell_id, memo) -> (stored::Bool, why::String)Store a cell's current result under memo.key without running it: the values of memo.names as the worker holds them and the output of the cell's last run there. Refused when that run was under another key or the worker holds none; only a worker that is already up is asked. The in-process kernel has no durable store.
KaimonSlate.ReportEngine.memo_pin! Method
memo_pin!(kernel, report, key::AbstractString, pin::Bool) -> nothingPin (pin=true) or release (pin=false) a memo entry against gc eviction — the locked cell tag's durability guarantee (§ set_cell_tags!). The in-process kernel has no durable memo store, so this is a no-op there.
KaimonSlate.ReportEngine.module_help Method
module_help(kernel, report, name) -> DictLive help lookup for name (a binding or module), resolved WHERE cells evaluate — {name, module, doc, kind, exports}. Powers the docs palette's ?Module drill-down (list a package's exports) + cross-reference links. The gate kernel forwards to its worker, where the notebook's packages live.
KaimonSlate.ReportEngine.module_help Method
module_help(where, name) -> DictResolve name in module where (the package must already be using'd / imported there) and return a help record: {name, module, doc, kind, exports}. kind is "module", "function", "type", "const", or "unknown". For a Module, exports lists its exported bindings as {name, kind} (sorted) for drill-down; empty otherwise. doc is the raw @doc text (markdown). Pure (Base.Docs + reflection only) so it loads into the dependency-light worker, exactly like harvest_module_docs.
A bare identifier that doesn't resolve is retried case-insensitively (exact case still wins), so regionplan finds RegionPlan — see _ci_resolve_name.
KaimonSlate.ReportEngine.name_uuid_mismatches Method
name_uuid_mismatches(entries) -> Vector{String}For name => uuid pairs, a description of each whose UUID a registry records under a different name: "GLMakie = 13f3f980-… (CairoMakie's UUID)". Pkg accepts such a pair without complaint and writes it into the project and manifest, after which the package that UUID really belongs to can no longer be added. A UUID no registry here knows is not reported.
KaimonSlate.ReportEngine.note_defines! Method
note_defines!(report, cell, names) -> BoolRecord globals a run of cell was seen to bind (:defines, reported by the capture). The ones its analysis didn't predict join cell.observed, which the next graph build adds to its writes, so a reader of a global the cell binds in a way the analysis can't see (a helper that evals into the notebook, an unexpandable macro) gets an edge to it. Returns true when something new was learned and the graph needs rebuilding.
KaimonSlate.ReportEngine.note_run! Method
note_run!(report, cell, out) -> BoolRecord what a run of cell showed: the globals it bound that the analysis missed (note_defines!), and that a clean run of this source has now been observed (observed_complete). Returns true when the graph needs rebuilding. A restore from the cache ran nothing, so it shows nothing.
KaimonSlate.ReportEngine.origin_dir Function
origin_dir(origin, base = "") -> StringA footer's checkout path as a directory on this machine: ~/… under the home directory, a relative path under the notebook's project base (a checkout inside the project is recorded relative to it, so the footer holds wherever the project is cloned), an absolute path as it is.
KaimonSlate.ReportEngine.package_change Method
package_change(before, now) -> StringWhat changed between two env_packages lists, as a clause ("CUDA was added, JSON was removed"), or "" when the direct packages and their versions are the same.
KaimonSlate.ReportEngine.page_columns Function
page_columns(provider) -> Vector{ColumnDef} — the provider's columns.
KaimonSlate.ReportEngine.parent_manifest Method
parent_manifest(parent) -> StringAbsolute path of the manifest that RESOLVES the project in directory parent, or "" when there is none. For a workspace member that is the workspace root's shared manifest; otherwise the manifest beside the project, honouring the versioned (Manifest-v1.12.toml) names and an explicit manifest = key — the same order Julia's loader uses.
KaimonSlate.ReportEngine.parse_error_text Method
parse_error_text(src) -> StringThe parser's report for code that does not parse, naming the line and column; "" when it parses.
KaimonSlate.ReportEngine.parse_region_options Method
parse_region_options(text) -> Dict{String,String}Scheduler options written as text: key=value entries separated by ; or newlines, a bare key being a switch (exclusive). Separators are not commas because sbatch values carry them (nodelist=nid[001-003],nid005). Throws an ArgumentError naming the entry for a malformed key, and for one of the settings a region has its own field for, since the request drops those from options.
KaimonSlate.ReportEngine.parse_report Method
parse_report(text; id="r", title="") -> ReportParse hybrid source into a Report. Two interchangeable conventions are accepted — liberal in, canonical out (serialize_report always emits the explicit #%% form):
Explicit percent cells: a
#%% [code|md] [id=…]header introduces a cell whose body runs verbatim until the next header.Literate-style (implicit): before any header, a run of comment lines becomes a markdown cell only when it reads as prose (a heading/list/rule marker, a blank line before the code, or no code after it); an ordinary comment that hugs the code below it stays an inline comment on that code cell. Bare code runs are code cells. See [
_append_implicit_cells!].
Pure-Literate files, pure-percent files, and Literate-then-percent mixes all parse. (Once a #%% header appears, subsequent cells should also use headers — implicit content after a header is taken as that explicit cell's verbatim body.)
KaimonSlate.ReportEngine.pending_macro_cells Method
Flagged cells whose macro bindings are still unrecovered (no cache entry, not marked tried).
KaimonSlate.ReportEngine.pick_on! Method
pick_on!(name::Symbol, figure, axis)Point the pick control name at axis of figure: from here on, a click inside that axis sets the bind, in data coordinates.
Call it from the cell that BUILDS the figure, which is also the cell that reads the bind — the control is declared without a figure precisely so this can happen afterwards. It declares a cell effect rather than setting anything, so the calibration rides out with the figure it describes and cannot get out of step with it: re-run the cell, change the limits, resize, and the next calibration replaces the last. Outside a harvesting eval (a plain julia notebook.jl) it is a no-op, so a notebook still runs as a script.
@bind p PickPoint(; snap = 0.05)
fig = Figure(); ax = Axis(fig[1, 1]); heatmap!(ax, xs, ys, Z)
scatter!(ax, [p.x], [p.y])
pick_on!(:p, fig, ax)
figCALL IT LAST. It measures where the axis IS, so anything that changes the layout afterwards — a title, an axis label, a legend, another plot in the figure — moves the axis out from under that measurement, and every click then lands offset by however far it shifted. That failure is silent: the control still returns coordinates in range, they are just the wrong ones. A title that reports the picked value is the trap worth naming, because it changes the layout on every pick; put that readout in a markdown cell below the figure instead.
KaimonSlate.ReportEngine.pkg_error Method
pkg_error(lines) -> StringThe error a Pkg subprocess ended with, from the last lines of its output: the ERROR: line and what follows it up to the stacktrace.
KaimonSlate.ReportEngine.pkg_op Method
pkg_op(kernel, report, op, name; target="notebook") -> Dict{String,Any}Add (op="add"), remove (op="rm") or update a package. target="notebook" operates on the notebook's OWN env; target="project" operates on the enclosing project, shared with everything else in it. Both kernels offer both targets.
The gate kernel hands the operation to its worker. The in-process kernel has no worker, so it does the same work here: activate the target environment, run the op, and put the host's own project back. That activation is process-global for its duration, which is why it is serialised — see InProcessKernel for why in-process layers environments instead of resolving one.
Never operates on the host's active project. Adding a notebook's package to the environment the hub itself is running out of would write a dependency into whatever project launched Slate. Returns {ok, message}.
KaimonSlate.ReportEngine.placement_note Method
placement_note(r, a; waited = nothing) -> (; state, text)What region r's request for a node came to (a, the allocation region_place! returned), said the same way wherever it is shown. state is :granted, :queued, :refused or :unreachable; text is the line to show: the job and how long it has waited (waited, seconds), the scheduler's expected start and what it is waiting on, or its reason for turning the request down. grown is true when the scheduler holds more CPUs for the job than the region asked for, which the text says.
KaimonSlate.ReportEngine.preflight_remote Method
preflight_remote(host; transport=:tunnel, on_step=nothing) -> DictTest + prime host: ssh reachability, Julia presence (+version), env provisioning, KaimonGate load, CURVE key (for :direct), then a real spawn → connect → round-trip eval → clean teardown. Returns Dict("host","transport","ok",steps=>[{name,status,detail,ms}…]). Idempotent and self-cleaning: it leaves the primed env behind (so the first real run is fast) but no worker or tunnel running. on_step(::PreflightStep), if given, is called as each step STARTS (status "run") and COMPLETES — so the SSE endpoint can stream progress live instead of blocking for the whole (minutes-long) run.
KaimonSlate.ReportEngine.prepare! Method
Ensure the kernel's namespace exists and is ready to evaluate into.
KaimonSlate.ReportEngine.prepare_batch! Method
prepare_batch!(machine; project, resources = NamedTuple()) -> DictPrepare machine for project's sweeps: the machine's own steps (sign in, Julia, the site, the depot), then build the project's task environment there and run one test task through the scheduler with resources (the sweep's node type; the walltime is short and the machine's test_qos applies). Blocking; returns the record, and keeps a report like every prepare.
KaimonSlate.ReportEngine.prepare_failed_to_start! Method
prepare_failed_to_start!(name, err)Record a prepare that ended before its first step, so whoever asked sees why rather than nothing: it shows as a finished prepare with one failed step carrying the error.
KaimonSlate.ReportEngine.prepare_machine! Method
prepare_machine!(machine) -> DictThe steps every prepare of machine starts with, on their own: sign in, Julia, read the site, settle the depot. What they find is recorded for the host, and every region and sweep on it uses it. Blocking; keeps a report like every prepare.
KaimonSlate.ReportEngine.prepare_region! Method
prepare_region!(name; node = nothing, project = "", keep_node = false, worker = nothing) -> DictPrepare region name: sign in, put Julia and the worker runtime in place, read the site, create the data root, and on a scheduler region (by default the first time only, or as node says) start a worker on a granted node to time its loads and check its GPUs. project (a notebook or a project folder; the region's preload when empty) is installed and loaded on that node (on the host itself for a region without a scheduler), which is where CUDA is checked, and leaves the environment there ready for that project's first start. keep_node leaves the node held for the notebook that asked. worker is that notebook's own worker, as (start = fresh -> started, run = code -> stdout) (fresh replaces a running one; start returns false when the worker was already up, so its earlier start and load times stand): when given, the packages are loaded in it rather than in a throwaway process, and it stays up for the notebook's cells. Returns the readiness record, which is also stored in the region. Runs to the end even when a step fails, recording each step's outcome, so one problem does not hide the next. Blocking; callers that cannot wait spawn it.
KaimonSlate.ReportEngine.prepare_report Method
One prepare report of region name in full, or nothing.
KaimonSlate.ReportEngine.prepare_reports Method
prepare_reports(name) -> Vector{Dict}Every prepare of region name this hub has run, newest first: id, started, outcome, the project it tested, and how many steps warned or failed.
KaimonSlate.ReportEngine.prepare_running Method
prepare_running(name; env = nothing) -> BoolWhether a prepare of region name is running now. With env, only one that prepares that environment (what _reference_env makes of a notebook or project): a prepare for another notebook installs into its own environment and leaves this one's alone.
KaimonSlate.ReportEngine.prewarm_macros! Function
prewarm_macros!(report, kernel=InProcessKernel()) -> BoolPre-eval macro expansion (peer of prewarm_usings!): recover unknown-macro bindings BEFORE a run so the graph — and the memo keys derived from it — is precise from the first eval. Package macros (Base.@kwdef, @enum, DataFrames' @chain, …) expand here because prewarm_usings! already imported their modules; notebook-defined macros resolve post-drain in refine_macros!. Failures are NOT marked tried — the macro may get defined during the run. Returns true iff something newly resolved (deps rebuilt).
KaimonSlate.ReportEngine.prewarm_usings! Function
prewarm_usings!(report, kernel=InProcessKernel()) -> BoolPre-eval counterpart of refine_usings!: resolve bare-using exports BEFORE a run, so the dependency graph — and every memo key derived from its upstream closures — is computed in precise form from the very first eval of a session. Without this, a fresh session analysed using X as an :opaque barrier, keyed the first run's memo entries against that conservative graph, then flipped to the precise graph post-drain (refine_usings!) — so every cell below a using changed memo keys between the first and second run of each session and MISSED the durable cache exactly when it mattered most (cold open). Returns true iff a module was newly resolved (deps rebuilt).
KaimonSlate.ReportEngine.profile_arm! Function
Profile the next run of cell (see ProfOpts).
KaimonSlate.ReportEngine.profile_arm! Method
Profile the next run of cell on this kernel.
KaimonSlate.ReportEngine.profile_prepare! Method
profile_prepare!(kernel, report; cell, source, reads) -> DictCompile the cell's code where it runs, without running it (see profile_prepare!(::Module)).
KaimonSlate.ReportEngine.profile_prepare! Method
profile_prepare!(mod; cell, source, reads) -> DictCompile source (cell cell) where it runs, without running it. The statements that can live in a function become __slate_prof_<cell>(reads...), and precompile at the types of the reads' current values compiles every call inference can resolve. What it cannot reach is what the run dispatches at runtime, which the profile then shows as compilation on the line that caused it.
KaimonSlate.ReportEngine.profile_result Method
The last profile taken of cell, or nothing.
KaimonSlate.ReportEngine.profile_result Method
The last profile of cell taken on this kernel, or nothing.
KaimonSlate.ReportEngine.profile_source Method
profile_source(file) -> DictThe text of file on this machine, for the view's code pane: a frame in a package is shown from the depot this process loaded it from, so a region shows the version it ran. Base's relative paths (./array.jl) resolve through Base.find_source_file.
KaimonSlate.ReportEngine.profile_source Method
A source file as this kernel's machine has it, for the profile's code pane.
KaimonSlate.ReportEngine.project_deps Method
project_deps(kernel, report) -> Vector{Dict}The notebook project's direct dependencies as {name, version} (for eager docs auto-indexing — everything reachable is worth indexing, so this is intentionally unfiltered). The gate kernel reads its worker's active project; the in-process kernel reads the notebook's own env, under the same scope swap a cell runs in — so what gets indexed is what the notebook can actually using, not what the hub happens to carry.
KaimonSlate.ReportEngine.project_file_in Method
The Project.toml/JuliaProject.toml in dir, or "".
KaimonSlate.ReportEngine.provision_remote! Method
provision_remote!(t::RemoteTarget, parent_project; rebuild = false) -> SymbolIdempotent. Ensure the host can run a SlateWorker: (1) send Slate's worker payload, (2) materialise a KaimonGate worker env (added from the registry) + Revise, instantiate, (3) put the notebook's environment there: built when the host has none or another, else kept as it is, its sources sent when they changed. rebuild (a prepare) also tests that the depot still holds the environment and fetches what it lost. Returns what became of the environment (_env_action): :build, :repair, :held or :keep.
KaimonSlate.ReportEngine.prune_notebook_envs Method
prune_notebook_envs(; apply = false, roots = [homedir()], unmatched = false) -> Vector{NamedTuple}Each notebook env under notebook_envs_root() with what happens to it: :keep or :remove, why, and its size. Removed: an env whose notebook (named by its .slate-notebook) is gone, and an env that holds only a Project.toml with no packages, which opening its notebook recreates. An env with no record is looked for among the notebooks under roots by the path hash in its name, and marked when found; one that matches no notebook is :unmatched, removed only with unmatched = true. An env that holds anything but environment files is always kept. Nothing is deleted unless apply.
KaimonSlate.ReportEngine.pull_blob! Method
pull_blob!(host_ip, data_port, hash; server_key="", timeout_ms=20_000) -> IntPULL one content-addressed blob from a worker's store over the data channel ('G' chunks) into the LOCAL memo CAS — the reverse of push_memo_blobs!; how remote results flow back (region runner: a remote cell's writes that local cells read). Streams into a tmp file, sha-verifies against the address, atomic-renames — a truncated/corrupt transfer never lands. Dedup first: an already-present blob costs nothing. Returns bytes moved over the network (0 = deduped).
KaimonSlate.ReportEngine.push_blob! Method
push_blob!(host_ip, data_port, hash; server_key="", timeout_ms=20_000) -> IntShip ONE blob from the LOCAL CAS to a worker's store over its data channel (dedup-aware: the 'H' query makes an already-present blob cost one round-trip). The region runner's local→remote half; pull_blob! is the reverse. Returns bytes actually sent (0 = deduped).
KaimonSlate.ReportEngine.readd_specs Method
readd_specs(delta; pinned = false, base = "") -> (; devs, adds, skipped, mismatched)Pkg.PackageSpec keyword sets that re-create a notebook's OWN packages (its Slate.env records) after a re-seed, each the way it was added: a local checkout (source = "path") is developed from its path, a git package ("git") is added from its url#rev, and any other package is added by name and uuid. A checkout whose path does not exist on this machine goes to skipped, so the rest still install. A relative checkout path is under base, the notebook's project (see origin_dir).
A registry record whose UUID a registry files under another name (a footer edited by hand, the name changed and the UUID left) is not added: Pkg would install it under the wrong name, and the package that UUID belongs to could then not be added. Its description goes to mismatched.
Seeding rebuilds a fork from its PARENT, which knows nothing about what the notebook added, so every rebuild path re-adds these afterwards. A registry package is left to resolve unless pinned: its recorded version would fight the parent's fresh resolution, which is the thing that just changed.
KaimonSlate.ReportEngine.readiness_check! Method
readiness_check!(t::RemoteTarget; seen = nothing)On a start, compare what preparing recorded about the region's machine with what its host reports now, and mark the machine stale when they differ. seen is the host's state when the caller already read it (_host_state); otherwise one command reads the stamps. Never blocks the start.
KaimonSlate.ReportEngine.readiness_text Method
The readiness of region r in a few lines: when, the outcome, and what it set for run time.
KaimonSlate.ReportEngine.ready_envs Method
The tested environments that are ready now on host, as Sweep.env_keys.
KaimonSlate.ReportEngine.reap_remote_worker Method
reap_remote_worker(host, port) -> BoolKill the worker on host:port (SIGTERM, then SIGKILL, with its children) and remove its script/log/manifest once it is gone. The one remote kill: a manual reap, a teardown kill, and the attach, reconcile and release paths that end a worker all come here.
REMOTE only: it reaches the worker over ssh and matches its worker-<port>.jl script, neither of which exists for a local worker (spawned inline with -e and owned by the hub as a process). Returns whether the kill reached something, so the caller can report the outcome rather than assume it.
KaimonSlate.ReportEngine.record_env_test! Method
record_env_test!(host, project, nodetype; by, status, depot, kw...)Record that project's environment was loaded on host's nodetype nodes, by a region's prepare (by = its name) or a test task. kw are the measurements (load_s, cuda, report, …). Replaces the earlier record for the same project and kind of node. The record keeps the project's packages (env_packages), so a later reason can say which of them changed.
KaimonSlate.ReportEngine.record_field Method
Walk a.b.c from the record kept for cellid. nothing when the cell or the path is unknown.
KaimonSlate.ReportEngine.record_field_range Method
record_field_range(source, field) -> (from, to) | nothingrecord_field_span translated to what the editor indexes by: JS string offsets, from inclusive and to exclusive, zero-based. CodeMirror counts UTF-16 units and Julia counts bytes, so a cell with ζ or an emoji above the tuple would otherwise highlight a range sliding left of the text.
KaimonSlate.ReportEngine.record_field_span Method
record_field_span(source, field) -> (from, to) | nothingThe byte range in source to highlight for record field field (a dotted path uses its FIRST segment — a nested record's fields live in their own tuple and the outer one is what this cell wrote). 1-based and inclusive, so source[from:to] is the text.
KaimonSlate.ReportEngine.record_html Method
record_html(nt::NamedTuple) -> String | nothingThe HTML a NamedTuple cell value renders as: a grid of its fields, each value formatted for reading (see the notes at the top of this file). nothing for an empty one, which keeps its text.
KaimonSlate.ReportEngine.record_matrix_render Method
record_matrix_render(cell, field) -> DictOne matrix field of a cell's remembered record, rendered by slate_matrix — the SAME renderer a bare matrix gets, not a second-best built for the grid. So the popup shows an ECharts heatmap or the KaTeX form exactly as that matrix's size and structure warrant.
{kind = "echart", option} or {kind = "latex", tex}, plus label; {error} when the value is no longer held (the cache is bounded) or the path names no matrix. Lives here so the gate worker and an in-process kernel answer the request with one implementation.
KaimonSlate.ReportEngine.record_sample! Method
Keep one telemetry sample for a kernel connection and pass it to the page, wherever it was taken.
KaimonSlate.ReportEngine.recorded_toolcall Method
recorded_toolcall(name, args, ok, text, seconds, at; handlers) -> ToolCallThe panel for a call that ALREADY happened, without dispatching it again.
An agent's call is observed after the fact, so there is nothing left to run: the outcome is handed in and only the tool's declared schema is looked up. What this buys is that a recorded call renders as the same panel a @tool cell does, rather than as a transcript of its reply, so it carries the handle, the parameter surface, and the follow-up the reply named. That is what lets a recorded call that started background work track it, instead of freezing on the sentence that started it.
KaimonSlate.ReportEngine.refine_macros! Function
refine_macros!(report, kernel=InProcessKernel()) -> BoolPost-drain macro expansion (peer of refine_usings!): by now every macro a cell could define or import has had its chance to exist, so expand the still-pending cells and mark failures tried (attempt-once per source; an edit to the cell — or to a macro-defining cell, see update_source! — clears the way for a retry).
Unlike refine_usings! (which only NARROWS), recovering a macro-hidden WRITE adds an edge. A PARALLEL drain was scheduled without it, so a reader may have raced its producer (errored on the not-yet-defined name, or silently consumed the previous run's value) — with restale_racers = true (the parallel server path) everything downstream of a newly-recovered writer is restaled once ("staleness never under-invalidates") and the caller's runner re-arms. A serial drain executes in document order — a valid topological order even without the edge — so the default skips the restale. Returns true iff something newly resolved (deps rebuilt).
With rebuild=false the caller rebuilds the graph and restales (restale_macro_racers!) itself; pass a set as recovered to receive the cells whose recovery included a write.
KaimonSlate.ReportEngine.refine_usings! Function
refine_usings!(report, kernel=InProcessKernel()) -> BoolPost-eval progressive precision: for each code cell still an :opaque barrier because of a bare using X that has now SUCCESSFULLY run, resolve X's exports and cache them, then rebuild the dependency graph so the barrier becomes a precise import. No cell is restaled — this runs after a drain, and narrowing a cell's dependents can only shrink the blast radius (see [build_dependencies!]). Idempotent: each module path is attempted at most once per session. Returns true iff a module was newly resolved (and deps were rebuilt).
KaimonSlate.ReportEngine.region_acquire_trace Method
region_acquire_trace(r; maxlines = 60) -> StringThe orchestration lines for bringing up r's worker: queued for a node, node granted, the provisioning steps, spawn, and connect. Read from the region's own trace buffer, which _rlog fills while the bring-up runs (see with_rlog_region), so the worker panel can show live progress during the one window a worker has no log of its own yet. Empty when nothing has been recorded, so the caller keeps its own placeholder text.
The buffer is per process: it holds this hub's bring-ups, not a previous instance's, which is what a reader watching a live acquisition wants.
KaimonSlate.ReportEngine.region_alloc_name Method
The job name an allocation for this region is found by — the same one on every reopen, which is what lets a notebook ATTACH to the allocation it was already using instead of queueing for a second.
KaimonSlate.ReportEngine.region_allocation Method
The allocation this region is holding, for the UI. Read-only — it never asks for one.
KaimonSlate.ReportEngine.region_depot Method
The depot region r's workers use.
KaimonSlate.ReportEngine.region_envs Method
The machine's tested environments on region r's kind of node, each marked changed when it is no longer the one tested.
KaimonSlate.ReportEngine.region_extend_lease! Method
region_extend_lease!(r, add_s) -> BoolPush the cached placement's expiry out by add_s, after the scheduler agreed to the same. The lease is what _placement expires the node on, so without this the hub drops a node it still holds.
KaimonSlate.ReportEngine.region_forget_placement! Method
region_forget_placement!(r) -> BoolDrop what this hub BELIEVES it holds for r, without telling the scheduler anything. True when there was a placement to forget.
The node goes as a unit: its route and its file syncer go with it. A watcher left pointed at a node we no longer hold pushes the next local edit to a machine the scheduler has already reassigned.
Distinct from region_release!, which gives the node BACK. This is for the case where it is already gone and only our record of it is left — an allocation killed from the cluster side, or one whose walltime ran out while the hub was not looking.
KaimonSlate.ReportEngine.region_host Method
region_host(r) -> StringWhere this region's workers live RIGHT NOW, without asking for anything. r.host for an ordinary region; the cached allocated node for a scheduler one, or r.host when no allocation is held — which is deliberate: a read-only caller (the roster, the UI) must never cause a queue submission.
KaimonSlate.ReportEngine.region_inherits Method
What region r takes from its machine when it sets nothing itself; empty for a region with none.
KaimonSlate.ReportEngine.region_machine Method
region_machine(r) -> MachineThe machine region r runs on: the one it names, or, for a region that names a host directly, an implicit machine on that host with every setting automatic.
KaimonSlate.ReportEngine.region_node_type Method
The kind of node a region's workers get (Sweep.node_type).
KaimonSlate.ReportEngine.region_own Method
region_own(name) -> DictWhat region name sets itself, as stored (empty for a machine's own region that was never edited).
KaimonSlate.ReportEngine.region_place! Method
region_place!(r; wait_s = 120) -> (host, allocation)Resolve where this region's workers go, ASKING the scheduler if it must. Returns the host to use and the Allocation behind it (nothing when the region needs none).
A :pending allocation returns ("", alloc): the queue has not granted a node, which is a cluster being busy rather than a failure — the caller reports it and reconciles again later.
submit = false only looks for the region's job, and places it when it is still running: what a notebook opening does, since only a person asks for a node.
KaimonSlate.ReportEngine.region_placement Method
The region's cached placement, or nothing — the hub's own record of the node and when it ends.
KaimonSlate.ReportEngine.region_reap! Method
region_reap!(r, name) -> nothingClean up after a region: its warm workers, and its peer-mesh artifacts. Takes the RECORD rather than looking it up, so it can run AFTER the record is gone.
That split is the point. Dropping the record is a file write; this is ssh to a host that may be slow, busy, or no longer there. A caller that has to tell someone the delete happened should wait for the first and not the second.
KaimonSlate.ReportEngine.region_remove! Method
Delete a region and clean up after it, in that order. Blocks on the whole thing.
KaimonSlate.ReportEngine.region_scheduler Method
region_scheduler(r) -> SymbolWhich scheduler this region actually uses: :none, or :slurm/:pbs. :auto asks the host what it has — a stored :slurm is honoured even when detection finds nothing, because the client tools may sit behind a module load that a probe cannot see.
KaimonSlate.ReportEngine.region_set! Method
region_set!(name; fields...) -> RegionCreate or update a region by name. Only the fields passed change: an existing region keeps the rest, and a new one takes REGION_DEFAULTS. Every caller sets a subset — a tool that knows nothing about schedulers, a form that has no cache_root — so replacing the whole record would reset whatever the caller did not mention.
KaimonSlate.ReportEngine.region_trace_reset! Method
Drop a region's acquisition trace, so the next bring-up starts clean rather than trailing the last one.
KaimonSlate.ReportEngine.region_where Method
region_where(r) -> (host, job)region_host together with the scheduler job that node belongs to ("" when no allocation is held), read from one placement so the two always describe the same grant. The host alone cannot tell two allocations apart on a cluster that grants the same node twice; the job can.
KaimonSlate.ReportEngine.registered_name Function
registered_name(uuid) -> Union{String,Nothing}The name a reachable registry records for uuid, or nothing when no registry here knows it (a private package, an unregistered one, or a machine whose registries can't be read).
KaimonSlate.ReportEngine.registry_add Method
registry_add(kernel, report, url) -> Dict{String,Any}Install a package registry into the depot the kernel's code runs in. Unlike pkg_op this is depot-GLOBAL — it affects every project on that machine — which is why it's a separate call with its own consent in the UI rather than something an install quietly does.
It has to run kernel-side rather than in the hub: a notebook on a remote region resolves against the REMOTE depot, so adding the registry in the hub's depot would leave the install still failing. Adding a registry that's already present is a no-op, not an error. Returns {ok, message}.
KaimonSlate.ReportEngine.remote_log Method
Tail the durable remote-orchestration log (last maxbytes).
KaimonSlate.ReportEngine.renders Method
Whether a cell of kind k shows anything: prose, or Julia that runs.
KaimonSlate.ReportEngine.report_module Method
Get (creating if needed) the report's execution namespace.
KaimonSlate.ReportEngine.request_stop! Method
Ask the runs ids (run ids; a cell id for an eval outside a run) to stop. Returns how many of them were running.
KaimonSlate.ReportEngine.reset! Method
Discard the kernel's namespace (full rebuild); cells are marked stale by the caller.
KaimonSlate.ReportEngine.reset_module! Method
reset_module!(report) -> ModuleDiscard the report's namespace and mark every cell stale — the basis of a full rebuild (ground truth, §6). Returns the fresh module.
KaimonSlate.ReportEngine.resolve_input_path Method
resolve_input_path(meta, rel) -> StringAbsolute path of a cell input (@asset/include literal), by the SAME two-step rule the run uses (__slate_read_path, widgets.jl): the notebook's assetbase, then the directory the .jl sits in when the first has no such file. The second step is what a detached notebook needs — its asset base is the per-notebook env dir, while the files the author means sit beside the notebook. Hub and worker must agree here, or a cell would read one file while the watcher and memo key track another.
KaimonSlate.ReportEngine.resolve_macros! Method
resolve_macros!(report, kernel, cells; mark_tried=false) -> BoolRound-trip cells' sources to the kernel for macro expansion (ONE batched call), re-analyze each expanded form, and cache the recovered (reads, writes). Returns true iff anything newly resolved (the caller rebuilds the graph). With mark_tried, a cell whose expansion failed is recorded so it isn't round-tripped again (post-drain semantics — its macros had their chance to be defined); the pre-run pass leaves failures unmarked so the post-drain pass can retry them.
KaimonSlate.ReportEngine.restale_macro_racers! Method
restale_macro_racers!(report, writers)Restale every cell downstream of a cell in writers, whose macro-hidden write was just recovered: a parallel drain ran it without that edge, so it may have raced its producer, even if it ran without error. A writer with another recovered writer downstream (two cells that write one name) is restaled too: they ran at the same time, so the later one may have disturbed the earlier, as two macros declaring one name in state the analysis can't see would. Needs the rebuilt graph.
KaimonSlate.ReportEngine.revise_apply! Method
Apply pending parent-/src revisions in the worker (Revise) → the changed top-level def-names.
KaimonSlate.ReportEngine.rides_session Method
rides_session(k, hosts) -> BoolWhether kernel k's wire is carried by an ssh session to one of hosts. True only for a :tunnel worker: its ZMQ connection is a forward on the host's session, so losing that session severs it. A :direct worker dials the node itself and outlives a sign-out, which is the whole point of choosing it — so it must not be dropped alongside.
KaimonSlate.ReportEngine.route! Function
Record that node is worked through login, inside kind job job. login = "" forgets it.
KaimonSlate.ReportEngine.run_cleanups! Method
Fire the given cells' cleanup callbacks in the report's in-process namespace (deleted-cell teardown).
KaimonSlate.ReportEngine.run_cleanups! Method
run_cleanups!(kernel, report, ids)Run the slate_on_cleanup callbacks that the given cells registered, in the namespace where they live (this kernel's) — used to tear down a DELETED cell's live per-cell resources (a Bonito Session). The gate kernel dispatches to its worker; in-process fires directly. A no-op for a base kernel / unknown ids.
KaimonSlate.ReportEngine.screen_text Method
screen_text(screen; last_rows = 0) -> StringWhat the screen is showing: lines joined with \n, trailing blank cells and trailing blank lines dropped, and SGR re-emitted around runs that share an appearance. The only escape sequences in the result are SGR.
last_rows renders only that many lines from the bottom, marking the elision with a leading …. feed! is incremental, but this is not — it walks the whole grid — so a caller that samples a screen repeatedly while it grows (the live stream) would otherwise pay for the entire transcript on every sample. It only ever displays the tail, so that is all it should ask for.
KaimonSlate.ReportEngine.seed_env_project! Method
seed_env_project!(envdir, parent) -> parent_pkg_nameWrite a forked env's Project.toml (the parent's [deps]+[compat]+[sources], with dev paths made absolute, plus anything it inherits as a workspace member) and copy the manifest that resolves the parent as the resolution baseline (path deps absolutised). PURE files — the caller does the Pkg.develop(parent) + Pkg.instantiate(). Returns the parent package name ("" when the parent isn't a package).
KaimonSlate.ReportEngine.series Method
series(kind, args...; name=nothing, kwargs...) -> EChartSeriesBuild one series for the composable echart(series(…), series(…); …) form — combine different kinds and axes in a single chart. kind is an ECharts series type:
:line/:bar/:area(x, y)— string x → category axis, numeric x → value axis:scatter(x, y):pie(labels, values):heatmap(z::Matrix)or(xlabels, ylabels, z)— adds category axes + a visualMap:candlestick(dates, ohlc)—ohlc[i] = [open, close, low, high]:radar(indicators, values)—indicators = ["Sales" => 6500, …]; values a vector, or["Allocated" => […], "Actual" => […]]for several rings:boxplot(categories, data)— eachdata[i]is[min,Q1,med,Q3,max]or raw samples:sankey(links)or(nodes, links)— flows; each link(source, target, value)orsrc => tgt => val:graph(edges)or(nodes, edges)— a network; each edge(source, target)orsrc => tgt(force layout):treemap/:sunburst(tree)— a hierarchy:name => value(leaf),name => [children…](branch), or NamedTuple/Dict nodes; pass one root or a vector of roots:lines(from, to)or(flows)— geo trajectories/flows; coords(lon, lat); bindscoordinateSystem="geo"(passgeo=(map="world",…)+registerMap):calendar(dates, values)— a calendar heatmap; brings the calendar component + a visualMap
Any other kind falls back to data = args[1]. name= labels the series for the legend; every extra kwarg (smooth, stack, symbolSize, yAxisIndex, areaStyle, markLine, lineStyle, …) splices into the series option verbatim.
echart(series(:bar, x, a; name="obs", stack="t"),
series(:line, x, b; name="fit", smooth=true, yAxisIndex=1); legend=true,
yAxis=[(name="obs",), (name="fit", type=:log)])KaimonSlate.ReportEngine.session_host Method
The host whose SESSION carries this kernel's wire — its route's login node, or its own host. "" = local.
KaimonSlate.ReportEngine.set_bind_value! Function
set_bind_value!(report, cell, name, value, kernel=InProcessKernel()) -> cellApply a browser value change for bound variable name (one of cell.binds): route it through the kernel (assign_bind! coerces against the widget, updates the per-notebook registry, and assigns the global), then mirror the coerced value into the host-side BindSpec. No-op if the cell has no such bind.
KaimonSlate.ReportEngine.set_bind_value! Function
Convenience: set the sole bind of a single-control cell (no-op unless exactly one).
KaimonSlate.ReportEngine.set_emit_channel! Method
Turn the emit channel on or off for every local worker of kernels, now.
KaimonSlate.ReportEngine.set_env_problem! Method
Record what a rebuild of envdir could not do, replacing what the last one recorded.
KaimonSlate.ReportEngine.shown_state Method
The state to show for c: RUNNING while a run is in flight, else its stored state.
KaimonSlate.ReportEngine.shutdown! Method
Shut the kernel down and clear gate state. A LOCAL worker is killed (clean exit request + SIGTERM/SIGKILL backstop). A spawned-remote worker is DETACHED by default — tunnel/sync closed, process left running warm (namespace + packages + memo store) with its state sidecar flipped to idle, so reopening the notebook reattaches instantly. kill_remote=true is for the paths where a surviving worker would be wrong: an explicit restart (reattach would make it a no-op), the preflight probe, and reap. An ATTACHED worker (k.remote) is never ours to kill either way.
KaimonSlate.ReportEngine.shutdown! Method
Release a kernel's resources (kill a local gate worker; detach a spawned-remote one unless kill_remote=true — see the GateKernel method). No-op for in-process.
KaimonSlate.ReportEngine.slate_checkpoint Method
slate_checkpoint()Throw InterruptException if the running cell has been asked to stop; otherwise do nothing. Call it in a long loop that reports no progress, so the cell's Stop can end it. Outside a cell it does nothing.
KaimonSlate.ReportEngine.slate_color Method
slate_color(name) -> StringA colour from the palette the slide math uses for terms (blue yellow red green purple orange teal pink lime sky), as a hex string Makie accepts. \termc{unstable}{red}{W^u} in an equation and color = slate_color(:red) in a figure are the same red.
KaimonSlate.ReportEngine.slate_completions Method
slate_completions(mod, code, pos) -> (; items, from, to)REPLCompletions against mod at byte offset pos. items is a Vector{Tuple{String,String}} of (text, kind); from/to are 0-based byte offsets of the range the completion replaces (CodeMirror-ready). Returns a NamedTuple so it rides the gate wire to the server unchanged.
KaimonSlate.ReportEngine.slate_fingerprint Method
slate_fingerprint(xs...) -> StringA canonical, session-stable content hash (SHA-256 hex) of the given value(s) — isequal-style semantics: Dicts/Sets are order-independent, NaN ≡ NaN, integer widths widen, missing and nothing are distinct. The robust way to assert a restored/recomputed/transferred value is REALLY the same — unlike hash, which leaks Dict order and session state. slate_fingerprint(df, params) in a cell gives one comparable line across runs, sessions, and worker restarts.
KaimonSlate.ReportEngine.slate_matrix Method
slate_matrix(M::AbstractMatrix; kind=:auto, rows=nothing, cols=nothing, max_cells=200*200,
downsample=true, colors=["transparent","#569cd6","#ffd700"],
blockrows=nothing, blockcols=nothing, digits=3)Render M as whichever form suits its size and structure: an exact KaTeX bmatrix (small), symbolic dotted notation (large + a recognized banded type — Diagonal/Tridiagonal/ SymTridiagonal/Bidiagonal/triangular), or a downsampled ECharts heatmap (large + anything else, including sparse). Any bare AbstractMatrix returned from a cell renders this way automatically; call slate_matrix explicitly to override the choice or its defaults.
kind— force:katex/:dotted/:heatmapinstead of auto-picking.rows/cols— crop to a sub-region BEFORE rendering (e.g. one tile of a periodic or block-repeating large matrix), as ranges.max_cells— the heatmap's downsample target (default 200×200 cells).downsample=falseforces full resolution — only safe for a matrix that already fits (pair withrows/colsto crop a large one down first; forcing full resolution on a large matrix directly can be extremely slow/memory-heavy).colors— the heatmap'svisualMapcolor ramp, low → high.blockrows/blockcols— block sizes for divider lines in the KaTeX form (e.g.[2,2]for a 4×4 matrix drawn as four 2×2 blocks).digits— rounding for the KaTeX forms.
KaimonSlate.ReportEngine.slate_memo_entries Method
slate_memo_entries(; name = "") -> Vector{NamedTuple}The durable memo store's entries, newest first — one row per cached cell result: (; key, names, bytes, blobs, created) where names are the globals the entry restores and blobs their content hashes (shared hash across rows = deduped storage). name = "x" filters to entries carrying a binding named x. Return it from a cell (or wrap in slate_table) to see exactly what a cold open will restore.
KaimonSlate.ReportEngine.slate_memo_stats Method
slate_memo_stats() -> (; manifests, blobs, bytes, root)Shape of the durable memo store backing this notebook's cache tags: entry count, unique content blobs (identical values dedup to one), total on-disk bytes, and the store root. In-process kernels have no durable store — all zeros.
KaimonSlate.ReportEngine.slate_query Method
slate_query(conn, sql; page_size=50) -> SlatePagedTableBrowse the result of sql (run against DBInterface connection conn, e.g. a DuckDB.DB or SQLite.DB) as a server-paged table: sorting, global search, and paging are pushed into SQL, so the browser only ever holds one page. The whole result set is never materialized.
KaimonSlate.ReportEngine.slate_table Method
slate_table(data; format, align, coltype, viz, default_format, title, paged, page_size, export_rows) -> SlateTable
slate_table(columns, rows; format, align, coltype, viz, default_format, title, export_rows) -> SlateTableBuild an interactive, sortable, filterable, paged table. RETURN it from a cell to render it — a bare DataFrame / Tables.jl source already auto-renders, so you only call slate_table explicitly to pass options. data may be a DataFrame / any Tables.jl source, a Vector of NamedTuple rows, or a Dict/NamedTuple of equal-length column vectors. The two-argument form takes explicit columns (names) plus rows (a vector of row vectors/tuples, or an AbstractMatrix). Cells are reduced to JSON-safe scalars; numbers stay numeric so the browser sorts them numerically.
Each column's physical type (:int/:float/:bool/:date/:string) and default alignment are inferred. The overlay options each take a NamedTuple/Dict keyed by column NAME — a ONE-entry NamedTuple needs its trailing comma: (Revenue = :currency,):
• format — per-column display formatting. A value is a preset Symbol, or a NamedTuple/Dict naming a kind plus overrides (digits, sep, prefix, suffix). Presets: :currency ($, 2 dp, thousands-grouped) · :percent (1 dp) · :integer (grouped) · :fixed (2 dp) · :scientific (3 sig figs) · :bytes (KB/MB/GB…). • align — :left / :right / :center, overriding the type-inferred default. • coltype — override the inferred physical type (e.g. force an id column to :string). • viz — an in-cell visualization for a NUMERIC column, scaled over its min→max: :bar (a proportional bar behind the value) or :heat (a background shaded by magnitude). To draw against a fixed range instead, give it: (Missing = (kind = :bar, domain = (0, 1)),). • default_format — one format spec (same DSL as a format value) applied to EVERY numeric column that doesn't have an explicit entry in format. Handy for a blanket default_format = :integer (round-to-nearest-int) instead of listing every column. • title — a caption above the table. Travels with it into every fixed export (PDF, HTML, markdown), which is what makes it worth setting over a markdown heading beside the cell: a table that gets moved, replayed or exported keeps the words that say what it is.
Example combining several:
slate_table(df; format = (Revenue = :currency, Margin = (kind = :percent, digits = 1)),
align = (Product = :left,),
viz = (Revenue = :bar, Margin = :heat))paged = true builds a SERVER-paged table: the provider stays where cells evaluate and the browser fetches one page_size-row page at a time, so the full result set never crosses the wire (use it for large data — slate_query(conn, sql) does the same for a SQL source). export_rows = n caps the rows shown in FIXED exports (PDF / markdown / static HTML) to the first n (with a "showing n of N" note); the live table stays fully paginated.
KaimonSlate.ReportEngine.slate_theme Method
slate_theme(; theme="") -> Makie.ThemeThe shared Slate look as a Makie Theme, built from the same brand palette the interactive ECharts figures use — transparent background, the Slate series colours, palette-toned grid/axes, and a default figure size that matches the ECharts cell height. Needs Makie loaded (using CairoMakie).
theme selects a palette by name ("midnight", "nord", "daylight", …); the default "" follows the ACTIVE UI theme, so a rendered plot matches whatever Slate theme is on. Compose extra styling on top with Makie's own update_theme!/set_theme!(base, overlay).
using CairoMakie
set_theme!(slate_theme()) # follow the active UI theme
set_theme!(slate_theme(theme="nord")) # or pin a specific palette
# or just: use_slate_theme!()KaimonSlate.ReportEngine.slate_tool Method
slate_tool(name; kwargs...) -> ToolCallCall a Kaimon MCP tool by name, and return the call as a value.
name is the tool's name on the Kaimon server: a Kaimon tool ("ping") or an extension's, qualified by its namespace ("fusionkb.search"). These are the tools an agent sees over MCP, so a notebook and an agent act on the same things. A name the server does not know is looked up among the tools registered in this worker's own gate, whose dispatcher coerces arguments against the handler's signature.
slate_tool("fusionkb.search"; query = "bootstrap current", limit = 5)@tool is the same thing in call syntax. slate_tools() lists what is available.
KaimonSlate.ReportEngine.slate_tools Method
slate_tools(; filter = "") -> tableEvery tool a @tool cell can call: the Kaimon server's (its own and every extension's), then any registered in this worker's gate that the server does not also list. Each with its parameter count and first documentation line; filter keeps only names containing that substring.
KaimonSlate.ReportEngine.slate_version_gap Method
slate_version_gap(project; slate = nothing) -> StringWhy Slate's worker cannot run in the environment of project as its manifest resolves it: a SlateExtensionsBase older than the worker needs, or a KaimonSlate of another major version than slate. "" when neither, or when there is no manifest to read. A project that uses Slate's API names KaimonSlate itself, and its manifest keeps whatever version it last resolved.
KaimonSlate.ReportEngine.slide_figure Method
slide_figure(fig; steps, fps = 30, px_per_unit = 1.5) -> SlideFigureA Makie figure that builds on a slide, one state per build step. steps is a vector; each entry is a NamedTuple saying what changes on that step:
show = plots— those plots appear (they are hidden until their step);hide = plots— those plots go;focus = plots— every other plot dims until the next step that setsfocus;focus = nothingundims. A plot shown later while the rest is dimmed joins the focus;limits = (ax, (x1, x2, y1, y2))— the axis moves to that window (smoothly, withframes); six values(x1, x2, y1, y2, z1, z2)for anAxis3;view = (ax3, (azimuth, elevation))— anAxis3camera turns to those angles (radians);(ax3, azimuth)turns about the vertical only.azimuth + 2πis a full turn;trace = tr— atrace!orbit draws itself along its points (one clip, 60 frames unlessframessays otherwise); several traces given together draw at once;terms = "name"— while this is the current step, the math terms\term{name}{…}on the slide light up, so the plot and its symbol in an equation are picked out together (a vector for several);animate = t -> …— called withtfrom 0 to 1 to change the figure, typically setting observables (n[] = round(Int, t * N)to draw a section point by point);update = () -> …— any other change, made once;frames = n— render the step as ann-frame clip atfpsinstead of one image. The moves of one step (limits,view,trace,animate) run together in its clip.
A plot is anything Makie returns from lines!, scatter!, callout!, trace!, …; pass several as a vector. The steps share the slide's step counter with its other builds (step i here is build step i). Rendering mutates fig, which ends in its final state. The axes keep the limits of the finished figure throughout, unless a limits step moves them. A figure with a transparent background (backgroundcolor = :transparent on the figure and its axes, e.g. through update_theme!) is drawn on the slide's own background; its clips are WebM with an alpha channel (VP9), which Chrome and Firefox play.
fig = Figure(); ax = Axis(fig[1, 1])
sec = scatter!(ax, R, Z; markersize = 1, color = :gray70)
wu = lines!(ax, Ru, Zu; color = slate_color(:red))
xp = callout!(ax, (RX, ZX), "X-point")
slide_figure(fig; steps = [(show = wu,), (show = xp, focus = [wu, xp]),
(limits = (ax, (RX - w, RX + w, ZX - w, ZX + w)), frames = 45)])KaimonSlate.ReportEngine.source_text Method
Alias kept for callers that think in terms of a cell's raw text.
KaimonSlate.ReportEngine.src_tree_files Method
Every .jl file under dirs, deterministically ordered.
KaimonSlate.ReportEngine.stamp_env! Method
Record the parent fingerprint envdir was seeded from (for later env_stale checks).
KaimonSlate.ReportEngine.stamp_env_precompiled! Method
stamp_env_precompiled!(t, parent_project, julia) -> BoolRecord that t's environment, already installed, has now been precompiled where its workers run, so the next start finds nothing to build. julia is the host's julia --version.
KaimonSlate.ReportEngine.standalone! Function
standalone!(m::Module = @__MODULE__; dir = nothing) -> ModuleInject the notebook-namespace contract into m so a Slate .jl runs as plain Julia (julia notebook.jl / include), Pluto-style. This is the single lever that makes a notebook runnable outside the Slate server: the same _populate_notebook_ns! contract is installed, but the live-only features degrade to no-ops.
@bind x W(…)→x = W's default (empty registry, no browser wiring) — the real bind path, so it works with no special-casing.echart/slate_table/slate_querybuild their display objects as usual (pure constructors); they render viashow/MIME if the run is display-capable, else are inert.slate_refresh/slate_progress/slate_emit/ reactive fires → no-op.@asset/readfile/datadir/@sfileresolve againstdir(the notebook file's directory), defaulting topwd().
Idempotent: a second call — or the Slate engine re-populating the same module — is a no-op (guarded on the __slate_standalone marker), so the emitted preamble never double-injects.
KaimonSlate.ReportEngine.start_sync! Method
start_sync!(t, parent_project; kernel = nothing, sent = false)Keep t's host copies of the notebook's parent project (its src/, into the worker env) and of each dev'd package (into its copy, _devsrc_path) current, telling kernel which files changed. sent says the copies were just sent whole (a provision), so only later changes travel; otherwise the first check sends whatever differs.
KaimonSlate.ReportEngine.stop_sync! Method
Stop keeping t's copies current (its kernel is going).
KaimonSlate.ReportEngine.stoppable_cells Method
The runs in flight now (those with a stop flag), by run id.
KaimonSlate.ReportEngine.strip_ansi Method
strip_ansi(text) -> StringDrop every escape sequence, colour included. For a renderer that applies its OWN styling to the text — the error message is syntax-coloured and the backtrace dimmed — where incoming colour is redundant at best and interleaves with that markup at worst.
KaimonSlate.ReportEngine.strip_sgr Method
strip_sgr(text) -> StringDrop SGR sequences, for consumers that render no colour (Typst/PDF export, plain-text tooling).
KaimonSlate.ReportEngine.sync_flush! Method
sync_flush!(k)Bring every host copy k's worker loads from up to date now, and have its Revise take the changes in, before a cell runs there. Costs one look at each source tree when nothing changed.
KaimonSlate.ReportEngine.sync_fork_preferences! Method
sync_fork_preferences!(envdir, parent) -> BoolCarry the parent project's preferences into the forked env at envdir, as its Project.toml [preferences]. A preference the notebook sets goes to the fork's own LocalPreferences.toml, which Julia reads over these, so the notebook's value wins. Returns whether the file changed.
KaimonSlate.ReportEngine.sysimage_candidates Method
sysimage_candidates(origin_env; project = "") -> Vector{Dict}The packages an image for this environment can hold, as a region lists them: its registered direct dependencies, and its project's when it is a notebook's own environment, each with the version it resolves and from (notebook or project). A package the environment has from a path (the project itself, a checkout) is left out: it loads normally on top of the image, so its edits are seen.
KaimonSlate.ReportEngine.sysimage_conflicts Method
sysimage_conflicts(img, origin_env) -> Vector{String}The packages the image record img holds at another version than the environment at origin_env resolves, each as "name (image V, notebook W)". A registered package is compared by its tree hash, one from a path by its version.
KaimonSlate.ReportEngine.sysimage_path_package Method
sysimage_path_package(r, path) -> DictThe package at path on region r's machine, from its Project.toml there: name, uuid, version, or ok = false with why it is not a package.
KaimonSlate.ReportEngine.sysimage_plan Method
sysimage_plan(t::RemoteTarget) -> (; use, key, dir, why)Whether a worker for t boots from its region's sysimage: the region boots from one, one has been built, and every package both the image and the notebook's environment hold is the same in both. Julia loads a package from the image whatever version the environment asks for, so a mismatch boots without the image rather than with versions nobody chose. why says what stopped it, "" when it was never asked for.
KaimonSlate.ReportEngine.sysimage_status Method
sysimage_status(r, worker_project) -> Union{Dict,Nothing}Region r's built image as its package dialog shows it, or nothing when none is built: its size, when it was built, how many packages it holds, the list it was built from (listed, nothing when that is not known), and the packages the notebook's environment on the machine (worker_project, "" when it has none there yet) holds at other versions.
KaimonSlate.ReportEngine.sysimage_view Method
sysimage_view(r) -> DictRegion r's sysimage as the page shows it: the image its workers boot from (size, CPU, when it was built, how many packages it holds), what it lists, and whether a build is running now.
KaimonSlate.ReportEngine.table_page Method
table_page(kernel, report, table_id, request) -> (rows, total)Fetch one page of a server-paged table (a slate_table(…; paged=true) / slate_query result), routing to the provider registered where cells eval. The request is the frontend's JSON body (page / page_size / sort_col / sort_desc / search). In-process providers live here; the gate kernel forwards to its worker.
KaimonSlate.ReportEngine.take_buffer! Method
An idle buffer from p, or a new empty one when none is idle.
KaimonSlate.ReportEngine.take_defines! Method
take_defines!(out) -> Vector{Symbol}Remove the capture's :defines records from a run's effects and return the names they carry. They feed the dependency graph (note_defines!) and are not effects the cell declared, so nothing that shows a cell's effects should see them.
KaimonSlate.ReportEngine.take_forget! Method
take_forget!(report) -> (cells, names)The removed cells and lost global names queued since the last call, cleared as they are returned. The caller hands them to forget! on every kernel the notebook runs cells in.
KaimonSlate.ReportEngine.tested_envs Method
Every environment tested on host's nodes: Sweep.env_key → record.
KaimonSlate.ReportEngine.tested_twin Method
tested_twin(host, project, nodetype; depot) -> Union{Dict, Nothing}The record of an environment that passed its test on host's nodetype nodes with the same contents as project's now, by the fingerprint, which covers what decides the resolve and not where it lives.
KaimonSlate.ReportEngine.tool_handle Method
tool_handle(tc::ToolCall) -> Union{String, Nothing}The identifier a tool handed back, recovered from the follow-up call its reply names.
Work that runs in the background returns a handle rather than an outcome, and states the call that reads it. This picks that handle out, so a cell can thread it onward instead of copying it by eye:
job = @tool start_job(size = 12)
@tool job_status(job_id = tool_handle(job))nothing when the reply names no follow-up carrying an id.
KaimonSlate.ReportEngine.toolcall_source Method
Render one recorded call as the source of a TOOL cell: the @tool form an author would have written, so the cell is re-runnable rather than a transcript of something that happened.
KaimonSlate.ReportEngine.trace! Function
trace!(ax, xs, ys[, zs]; color = :white, linewidth = 3, markers = false, head = true) -> traceAn orbit that draws itself along its points when a slide_figure step names it (trace = tr): the line grows point by point with a bright head at its tip and a soft glow on the stretch just behind it (tail, a fraction of the orbit; 0 for none), at an even pace per point, so a sampled flow runs smoothly and a map's orbit hops from iterate to iterate (markers = true leaves a dot at each one). The glow is gone once the orbit has closed. Give zs on an Axis3. Close a periodic orbit by repeating its first point at the end. Before its step it is hidden; tr.t[] (0 to 1) sets how far along it is for any other use, and a step can show, hide or focus it like a plot.
KaimonSlate.ReportEngine.update_source! Method
update_source!(report, new_source) -> reportReparse new_source, reconcile cells by id (carrying over cached output for cells whose source is unchanged), rebuild the graph, and mark changed cells + their transitive dependents STALE. Removed cells invalidate their former readers. Does not evaluate — call eval_stale! next.
KaimonSlate.ReportEngine.use_slate_theme! Method
use_slate_theme!(; theme="") -> nothingApply the slate_theme globally (Makie.set_theme!) so every Makie figure in the notebook matches the interactive ECharts look. theme names a palette; "" follows the active UI theme. Needs Makie loaded. Call it once in a setup cell (re-run it after switching the UI theme to re-render).
KaimonSlate.ReportEngine.via Method
How host is reached, or nothing when it is reachable on its own.
KaimonSlate.ReportEngine.watch_session_tools! Method
Start publishing every session tool call an agent makes, for the hub to record as a cell.
Registers a gate OBSERVER rather than wrapping handlers. Wrapping was the obvious approach and is wrong: a handler's signature IS its MCP schema (_reflect_tool reads it), so a wrapper with (args...; kwargs...) silently strips a tool's parameters and the agent can no longer call it. Observing leaves the tool untouched.
Idempotent — safe to call after every cell, which is what catches the tools a package registers when a cell first loads it.
handlers is a thunk returning the notebook's JS→Julia handler registry (the namespace is replaced on reset, so it cannot be captured once), used to make the recorded panel callable.
KaimonSlate.ReportEngine.watched_workers Method
The workers this hub is watching for telemetry only, as (host, port).
KaimonSlate.ReportEngine.with_rlog_region Method
Run f with _rlog lines mirrored into region name's acquisition trace. Empty name ⇒ no marking.
KaimonSlate.ReportEngine.worker_owner_tag Method
worker_owner_tag() -> StringWhich hub OWNS a worker, stamped into every worker's argv by _worker_script.
The restart reaper finds leftover workers with pgrep, which is machine-wide — and a hub is not alone on the machine: a worktree hub (KAIMONSLATE_HOME / KAIMONSLATE_PORT) is designed to run beside the installed extension, and any process that builds the tool list loads this code too. Without an owner stamp, one hub starting up SIGKILLs another's live notebook workers.
Identity is the state home plus the hub port: stable across restarts of the same hub, distinct between two hubs on one machine. Hashed rather than spelled out to keep the tag short enough for pgrep -f. A Julia upgrade changes the hash and the reaper simply finds nothing — it UNDER-reaps, which is the safe direction.
KaimonSlate.ReportEngine.worker_seb_compat Method
worker_seb_compat() -> StringThe SlateExtensionsBase versions Slate's worker runs with: SlateWorker's compat entry for it, or "" when that cannot be read.
KaimonSlate.ReportEngine.worker_seb_floor Method
The oldest SlateExtensionsBase Slate's worker runs with: the lower bound of worker_seb_compat().
KaimonSlate.ReportEngine.workspace_chain Method
workspace_chain(projectfile) -> Vector{String}The workspace roots above projectfile, nearest first (empty when it isn't a member). Nested workspaces are followed, so a member's inherited [sources]/[compat] can come from any level.
KaimonSlate.ReportEngine.workspace_parent Method
The ancestor project file whose [workspace] projects lists projectfile's dir, or "".
Report rendering
Turning evaluated cells into HTML/markdown output.
KaimonSlate.ReportRender Module
ReportRenderThe renderer half of the engine/renderer split (§15.1): turns an evaluated Report into a self-contained HTML artifact. Runs CLI-side, where the heavier template deps already live (OteraEngine, CommonMark). It only consumes the engine's Report/Cell data — no live module needed.
Escaping is correct by construction: one OteraEngine template with autoescape=true HTML-escapes all code/stdout/value text automatically; CommonMark-rendered markdown (already safe HTML) is injected via the |> safe filter. No hand-escaping (§8).
KaimonSlate.ReportRender._ansi_html Function
Cooked text → HTML, turning SGR runs into spans. inner escapes each plain run (and, for a backtrace, linkifies it), so escaping stays correct by construction.
KaimonSlate.ReportRender._katex_math Method
A :math segment in delimiters KaTeX is configured for: Documenter's two spellings become dollars.
KaimonSlate.ReportRender._math_parts Method
The TeX inside a :math segment, and whether it is display math.
KaimonSlate.ReportRender._md_segments Method
_md_segments(s) -> Vector{Pair{Symbol,String}}Markdown split into :code (fenced blocks and inline spans), :math (a span in any of Slate's four delimiters or Documenter's two, delimiters included), :dollar (a $ or \$ that is prose) and :text.
KaimonSlate.ReportRender.markdown_html Method
Markdown source → HTML (live notebook + md cells). interps are the captured outputs of the cell's blocks, spliced in document order. prose is applied to each markdown value spliced in, as the caller already applied it to the source (the live view's citation links, say), so spliced prose gets the same treatment as written prose.
KaimonSlate.ReportRender.output_html Method
output_html(cell) -> StringThe output fragment for a code cell (stdout / value / rich display / error), escaped and embedded. Used by the live notebook server to update a cell in place.
KaimonSlate.ReportRender.render_html Method
render_html(report) -> StringRender an (already-evaluated) Report to a self-contained HTML string.
KaimonSlate.ReportRender.render_report_file Method
render_report_file(path; out=..., title="", reset=false) -> out_pathEnd-to-end convenience: read a hybrid .jl, parse → evaluate → render → write HTML. Returns the output path.
Publish ledger
The record behind Publishing: documents, sites, targets and events, and the gist and local backends that persist them.
KaimonSlate.PublishLedger Module
PublishLedgerThe publish ledger: a small structured JSON record of what / when / where a document was published, plus each document's target config and optional site groupings. It is append-only over events and carries NO secrets — only slugs, URLs, DOIs, timestamps, commit SHAs, and statuses. Secrets live in the config home (SlateHome.secrets_file()), referenced here by secretRef.
Two design commitments drive the shape:
Documents are the base unit, not sites. A document publishes independently to a set of named targets; a site is an optional aggregation of documents. Publishing only ever touches OUTPUT (a
gh-pages-style branch), so nothing here pollutes a source repo.Events are append-only with a stable
id, so two machines that each publish can union-merge their ledgers without losing history (seemerge!).
Ledger ⟷ JSON round-trips losslessly (to_json / from_json); persistence and self-location are the LedgerStore backends' job (this file ships the local backend).
KaimonSlate.PublishLedger.Document Type
A published document identity: where it comes from, where it publishes, and its event history.
KaimonSlate.PublishLedger.Event Type
A single publish event — one target, one push. Immutable; appended newest-last to a Document.
KaimonSlate.PublishLedger.GhCli Type
Real client — drives GitHub via the authenticated gh CLI's api subcommand.
KaimonSlate.PublishLedger.GistClient Type
GistClientThe GitHub-gist operations GistStore needs, as an interface so tests can inject an in-memory fake. Implement gist_list, gist_read, gist_create, gist_update for a concrete client. Ships GhCli (shells out to gh api for deterministic JSON I/O).
KaimonSlate.PublishLedger.GistStore Type
GistStore(; client=GhCli(), marker=GIST_MARKER, filename=GIST_FILENAME,
pointer_file=<config_home>/ledger-pointer.json)Self-locating gist backend. pointer_file caches the resolved gist id; it is only a cache — the real pointer is the GitHub identity + marker convention, so a lost cache self-repairs via locate. save does create-on-first-write then fetch-before-write union merge thereafter.
KaimonSlate.PublishLedger.Ledger Type
The whole ledger: documents ↔ targets ↔ optional site groupings.
KaimonSlate.PublishLedger.LedgerStore Type
LedgerStoreA backend that persists and (self-)locates the ledger. Contract:
load(store)::Ledger— fetch + parse, or an emptyLedgerif none exists yet.save(store, ledger)— persist; load-merge-save so concurrent appends union rather than clobber.locate(store)— resolve/repair the pointer (returns aStringhandle, ornothing).
Backends (this file ships local; gist/repo/bucket/folder follow behind the same interface).
KaimonSlate.PublishLedger.LocalStore Type
LocalStore(path = SlateHome.ledger_dir()/kaimonslate-ledger.json)The XDG-data-dir backend: a single JSON file, no off-disk backup — the fallback when nothing else is configured. save still does a load-merge-save against the on-disk copy so two processes writing the same file union their events instead of one clobbering the other.
KaimonSlate.PublishLedger.SiteGroup Type
A logical site/portfolio: a canonical build (the local site dir) that deploys to a set of destination targets. Its document membership + order + sections live in that build's slate-site.json manifest.
KaimonSlate.PublishLedger.Target Type
A named target config — the NON-secret parts only. A secret is referenced by config["secretRef"].
Base.merge! Method
merge!(into::Ledger, other::Ledger) -> intoUnion-merge other into into: events are unioned by id (never lost, order preserved with newest last), document metadata and target/site config are last-writer = other. This makes concurrent writes safe (load → merge → save) and lets two machines reconcile their ledgers deterministically.
KaimonSlate.PublishLedger._reconcile_for_save Method
_reconcile_for_save(remote, mine) -> mineThe reconciliation a store applies before persisting mine over remote. mine is authoritative for structure — which documents/targets/sites exist and their config — so edits and deletes stick (the ledger is effectively single-writer for config; fine for a local-first workflow). But we still rescue events the backend has that mine is missing, for documents that survive in mine, so a concurrent machine's publish history is never lost. Callers must therefore load→mutate→save, not save a partially-built ledger. Mutates and returns mine.
KaimonSlate.PublishLedger.cached_ledger Method
cached_ledger() -> Union{Ledger,Nothing}The last ledger written to the local write-through cache — a no-network snapshot for instant UI paint. nothing if nothing has been cached yet (a fresh machine, before the first load/save).
KaimonSlate.PublishLedger.default_store Method
default_store() -> LedgerStoreThe backend to use when nothing is explicitly configured. KAIMONSLATE_LEDGER_BACKEND=local|gist forces one; otherwise GistStore when gh is authenticated (off-disk, self-locating, free version history), else LocalStore (local-only fallback — the UI should nudge the user to configure a backup).
KaimonSlate.PublishLedger.docid_git Method
docId for a git-backed notebook, from its repo-relative path and origin remote url.
KaimonSlate.PublishLedger.docid_local Method
docId for a non-git notebook, from its absolute path.
KaimonSlate.PublishLedger.from_dict Method
Build a Ledger from its plain-Dict (parsed-JSON) form; tolerant of missing sections.
KaimonSlate.PublishLedger.gh_authed Method
Is gh present AND authenticated (so the gist backend can actually reach GitHub)?
KaimonSlate.PublishLedger.gh_available Method
Is a gh binary on PATH at all?
KaimonSlate.PublishLedger.gist_create Method
Create a secret gist carrying the marker desc; returns the new gist id.
KaimonSlate.PublishLedger.gist_list Method
List the caller's gists as (id, description) — up to 100 (enough to find our single marker gist).
KaimonSlate.PublishLedger.gist_read Method
Read filename out of gist id; nothing if the gist or file is gone.
KaimonSlate.PublishLedger.gist_update Method
Overwrite filename in gist id.
KaimonSlate.PublishLedger.locate Method
locate(s::GistStore) -> Union{String,Nothing}Resolve (and cache) the ledger gist id via the self-location flow: in-process cache → pointer file → gist list matched on the marker (re-caching on a hit). Returns nothing only when no marker gist exists yet (the create-on-first-write case). List-first here is what stops two machines forking.
KaimonSlate.PublishLedger.merge_ledgers Method
Merge into a fresh copy, leaving both inputs untouched.
KaimonSlate.PublishLedger.new_event_id Method
A fresh, unique event id (evt_<time><rand>) — stable merge key, no coordination needed.
KaimonSlate.PublishLedger.now_ts Method
ISO-8601 UTC timestamp for now (seconds precision, Z suffix).
KaimonSlate.PublishLedger.record_event! Method
record_event!(ledger, docId, target; kwargs...) -> EventAppend a publish event to docId's history (creating a bare Document if unknown), auto-assigning a stable id and ts when omitted, and ensuring target is in the document's target list. Returns the appended Event. kwargs are the Event fields (status, url, doi, commit, bundle, note).
KaimonSlate.PublishLedger.to_dict Method
Plain-Dict form of the ledger (the JSON shape).
KaimonSlate.PublishLedger.to_json Method
Serialize a Ledger to indented JSON. Round-trips with from_json.
Memo store
The content-addressed store behind Memoization & Caching: manifests, blobs, pinning and garbage collection.
KaimonSlate.NotebookServer.MemoStore.drop_manifest Method
drop_manifest(root, key) -> BoolEvict the entry for key, returning whether one was there. Dropping the manifest IS the eviction: gc refcount-sweeps every blob no surviving manifest references, and a blob shared with another entry must not be removed here regardless. Used when a cell turns out not to be cacheable, where leaving an earlier entry in place would go on serving it.
KaimonSlate.NotebookServer.MemoStore.gc Method
gc(root; cap, grace = 900.0) -> nothingBound the store to cap bytes. Manifests are the roots, evicted oldest-mtime-first (restore touches its manifest, so mtime IS recency); a blob is deleted only once no surviving manifest references it — a shared blob outlives any one entry's eviction. grace (seconds) protects just-written blobs whose manifest hasn't landed yet: an unreferenced blob younger than it is never deleted, so a concurrent worker mid-put_blob→write_manifest can't be raced. Legacy fmt≤2 flat files at the root level (unreadable now) and stale temp litter are always swept. A set_pin!ned key is NEVER evicted, regardless of age or cap (the locked cell tag's durability guarantee) — pins can keep the store over cap indefinitely; that's the deliberate trade (no silent cap violates the guarantee worse than an oversized store does). Best-effort throughout: a vanished file (another worker's gc) is skipped, never an error.
KaimonSlate.NotebookServer.MemoStore.is_pinned Method
Is key currently pinned?
KaimonSlate.NotebookServer.MemoStore.put_blob Method
put_blob(f, root) -> (sha256_hex, bytes)Store the bytes f(io) writes, content-addressed. Streams through a temp file (no in-memory buffer — a multi-GB binding must not spike RSS), hashes it, then atomically renames into place. Content already present ⇒ the write is discarded (dedup) and the existing blob's mtime is refreshed (it was just re-referenced — resets the gc grace clock). Rethrows whatever f throws (e.g. an unserializable value), cleaning up the temp file.
KaimonSlate.NotebookServer.MemoStore.read_manifest Method
Read + fmt-gate the manifest for key: a Dict, or nothing (absent, unparseable, or wrong fmt).
KaimonSlate.NotebookServer.MemoStore.restores_no_bindings Method
restores_no_bindings(manifest) -> BoolWhether restoring manifest would define no globals at all. Combined with the caller's knowledge of what the cell DECLARES it writes, this separates a faithful entry from one that would hand back a cell's output while binding none of its names — a restore that silently skips the body and leaves every downstream reader undefined.
KaimonSlate.NotebookServer.MemoStore.set_libcrypto! Method
set_libcrypto!(path)Register an explicit libcrypto path — tried before the system names so a vendored, version-pinned lib (OpenSSL_jll) wins over whatever the host happens to ship. The worker calls this at startup; clears the cached backend so the next hash re-probes.
KaimonSlate.NotebookServer.MemoStore.set_pin! Method
set_pin!(root, key, pin::Bool) -> nothingPin (pin=true) or release (pin=false) key against gc eviction. Idempotent.
KaimonSlate.NotebookServer.MemoStore.sha_file_hex Method
sha_file_hex(path) -> hex::Stringsha256 of a file's bytes, hex. SHA-NI-accelerated (OpenSSL libcrypto) when available, else stdlib SHA.jl; identical output either way. Streamed in 1 MiB chunks — flat RSS on a multi-GB blob.
KaimonSlate.NotebookServer.MemoStore.stats Method
Store shape/size: (manifests, blobs, bytes) — cheap enough for telemetry.
KaimonSlate.NotebookServer.MemoStore.touch_manifest Method
Mark key recently used (manifests are the LRU roots gc evicts oldest-first).
KaimonSlate.NotebookServer.MemoStore.unbound_writes Method
unbound_writes(manifest, writes) -> Vector{String}The names in writes (what the cell defines now) that the entry neither binds, elides, nor records as left undefined by its run. An entry written for an older version of a cell can lack a name the cell defines today; restoring it returns the output and leaves that name undefined.
KaimonSlate.NotebookServer.MemoStore.with_blob Method
with_blob(f, root, h) -> (found::Bool, value)Open blob h and return (true, f(io)), or (false, nothing) when absent/invalid. The explicit flag (not a nothing sentinel) because a legitimately stored value can BE nothing (x = nothing is a cacheable binding).
KaimonSlate.NotebookServer.MemoStore.write_manifest Method
write_manifest(root, key, manifest) -> nothingPersist manifest (a TOML-representable Dict — the worker builds {bindings, wire, created, julia, …}) atomically under key. fmt is stamped here; callers never version themselves.
Effect store
Durable per-cell declared-effect records, keyed by cell source digest.
KaimonSlate.EffectStore Module
EffectStoreDurable, per-cell record of the effects a cell DECLARED via the code→Slate channel (slate_effect) — so a cell's everywhere classification and its statement-scoped re-establishment survive a hub restart / notebook reload WITHOUT the declaring cell having to run on main first this session.
Sibling of MemoStore: PURE (stdlib TOML only — no gate, no KaimonSlate deps), content-addressed by the cell's OWN source digest (editing the cell → new key → the record is re-established fresh; the old file is orphaned, never loaded for the new source). One small, human-readable, ls-able TOML file per key so a cell's declared effects are inspectable on disk, mirroring MemoStore's manifests.
KaimonSlate.EffectStore.load Method
load(root, key) -> Vector{@NamedTuple{kind,names,stmt_src}} | nothingLoad a cell's declared effect records, or nothing when none are stored (or the file is unreadable).
KaimonSlate.EffectStore.store! Method
store!(root, key, records) -> nothingPersist a cell's declared effect records — an iterable of (; kind, names, stmt_src). An empty records REMOVES any stale file for key (the cell no longer declares anything). Best-effort: a write failure warns and leaves the prior state, never throws into the caller.
State homes
Where Slate keeps its config, data and cache, as described under Configuration.
KaimonSlate.SlateHome Module
SlateHomeKaimonSlate's OWN XDG homes — deliberately separate from Kaimon's config dir and from the Julia depot, both of which are hazardous places to keep our state:
Kaimon's
~/.config/kaimon/is its config dir, not ours — our prefs don't belong there.a Julia depot scratchspace (
<depot>/scratchspaces/…) can be garbage-collected by Julia, which would silently reclaim a user's staged local sites.
Three homes, each env-overridable, all under a kaimonslate/ namespace:
| home | default ($XDG_… fallback shown) | holds |
|---|---|---|
| config | $XDG_CONFIG_HOME/kaimonslate (~/.config/…) | prefs (slate.json), secrets, ledger-id cache |
| data | $XDG_DATA_HOME/kaimonslate (~/.local/share/…) | ledger working checkout (durable, NOT a cache) |
| cache | $XDG_CACHE_HOME/kaimonslate (~/.cache/…) | local site builds (sites/<name>/, regenerable) |
Resolution precedence, most-specific first, for each home:
KAIMONSLATE_<HOME>_HOME— per-home override (KAIMONSLATE_CONFIG_HOME,_DATA_HOME,_CACHE_HOME)KAIMONSLATE_HOME/<sub>— single shortcut that sets all three (config/,data/,cache/subdirs)$XDG_<TYPE>_HOME/kaimonslate— standard XDG base dir~/.config|~/.local/share|~/.cache/kaimonslate— XDG defaults when the var is unset
Every entry is a function (not a const) so it re-reads ENV — tests point the vars at a tempdir.
KaimonSlate.SlateHome.cache_home Method
KaimonSlate's cache home — regenerable local site builds; safe to delete.
KaimonSlate.SlateHome.config_file Method
Path to the prefs file (moved off Kaimon's config dir).
KaimonSlate.SlateHome.config_home Method
KaimonSlate's config home — prefs, secrets, the ledger-id cache.
KaimonSlate.SlateHome.data_home Method
KaimonSlate's data home — the durable ledger working checkout (NOT a cache; never GC'd).
KaimonSlate.SlateHome.effects_dir Method
Durable per-cell declared-effect records (EffectStore), keyed by cell source digest.
KaimonSlate.SlateHome.ensure_homes! Method
mkpath each home that will be written to; returns the three paths.
KaimonSlate.SlateHome.ledger_dir Method
The durable ledger working checkout under the data home.
KaimonSlate.SlateHome.secrets_file Method
Path to the (gitignored) secret store — referenced by secretRef, never in the ledger.
KaimonSlate.SlateHome.sites_dir Method
Local site-build directory. KAIMONSLATE_SITES_DIR is the most-specific override (kept from the old API and used by tests); otherwise it's sites/ under the cache home.