Session workspaces, DB-pinned to session_state 1:1.
A workspace is the directory in which a session works: the folder where the user
started vis, or the folder that the session moved to. Vis does not require it
to be a git repository.
Vis never mutates JVM user.dir. Channels rebind workspace-root per
turn from the active workspace; tools resolve paths via
(workspace/cwd). There is NO process-cwd fallback in production -
the env carries :workspace/root from create-environment onward.
Session workspaces, DB-pinned to session_state 1:1. A workspace is the directory in which a session works: the folder where the user started `vis`, or the folder that the session moved to. Vis does not require it to be a git repository. Vis never mutates JVM user.dir. Channels rebind *workspace-root* per turn from the active workspace; tools resolve paths via (workspace/cwd). There is NO process-cwd fallback in production - the env carries `:workspace/root` from `create-environment` onward.
Configuration tiers the current session reads, a subset of config-sources. Nil
reads every tier. Bound from the session environment beside *workspace-root*.
Provider and sign-in settings in ~/.vis load in every case.
Configuration tiers the current session reads, a subset of `config-sources`. Nil reads every tier. Bound from the session environment beside `*workspace-root*`. Provider and sign-in settings in `~/.vis` load in every case.
Configured filesystem catalog entries available to the current tool call, as
canonical [{:root}] entries. These are rebuilt from vis.yml on
/reload; they are never session-persisted or mutable through a command.
Configured filesystem catalog entries available to the current tool call, as
canonical `[{:root}]` entries. These are rebuilt from `vis.yml` on
`/reload`; they are never session-persisted or mutable through a command.Canonical workspace root for the current tool call. Bound per-turn
by the channel layer; never nil in normal operation.
Canonical workspace root for the current tool call. Bound per-turn by the channel layer; never `nil` in normal operation.
(allowed-roots)Canonical absolute paths the current tool call may operate under: the primary
cwd FIRST, then each bound filesystem root. Deduped; the primary is always
present. The confinement set the editing layer's safe-path checks the target
against.
Canonical absolute paths the current tool call may operate under: the primary cwd FIRST, then each bound filesystem root. Deduped; the primary is always present. The confinement set the editing layer's `safe-path` checks the target against.
(ancestor-roots env-or-root)Canonical workspace root followed by each parent through the nearest ancestor
containing .git (inclusive). Outside a Git repository, continue through the
filesystem root. This is topology, not Git indexing: explicit project config
remains visible even when its directory is gitignored.
Canonical workspace root followed by each parent through the nearest ancestor containing `.git` (inclusive). Outside a Git repository, continue through the filesystem root. This is topology, not Git indexing: explicit project config remains visible even when its directory is gitignored.
(change-root! db-info session-state-id path)Repoint session-state-id's primary workspace root to path. Relative paths
resolve from the session's current root.
Repoint `session-state-id`'s primary workspace root to `path`. Relative paths resolve from the session's current root.
(change-session-root! db-info session-id session-state-id path)Repoint session session-id at path with change-root!, then keep its project
with its root. Clients list a session under the project of its root, so a session
filed in the old project and its group was in no list.
Repoint session `session-id` at `path` with `change-root!`, then keep its project with its root. Clients list a session under the project of its root, so a session filed in the old project and its group was in no list.
Configuration tiers a session can read: ~/.vis (global) and the workspace (project).
Configuration tiers a session can read: `~/.vis` (global) and the workspace (project).
Session setting that keeps the tiers a session was created with. The colon keeps it apart from snake_case toggle ids.
Session setting that keeps the tiers a session was created with. The colon keeps it apart from snake_case toggle ids.
(create-dir! parent name)Create a single child directory name under existing directory parent.
Returns the canonical path of the (possibly already-existing) child. Throws
when parent is not a directory or name is not a single safe path segment.
name may not contain a separator, be blank, or be ./...
Create a single child directory `name` under existing directory `parent`. Returns the canonical path of the (possibly already-existing) child. Throws when `parent` is not a directory or `name` is not a single safe path segment. `name` may not contain a separator, be blank, or be `.`/`..`.
(create-trunk-at! db-info root)Mint an unpinned workspace at root. Channels may pass a directory other than
the launch directory; returns the workspace row whose :id is passed as
:workspace-id at session creation.
Mint an unpinned workspace at `root`. Channels may pass a directory other than the launch directory; returns the workspace row whose `:id` is passed as `:workspace-id` at session creation.
(cwd)Resolve the current workspace cwd. In production the channel
wrapper binds *workspace-root* per turn, so the process-cwd
fallback only fires from REPL / test / one-off CLI paths that have
no session context.
Resolve the current workspace cwd. In production the channel wrapper binds `*workspace-root*` per turn, so the process-cwd fallback only fires from REPL / test / one-off CLI paths that have no session context.
(cwd-root)Canonical path of cwd: the key of the current project's scoped state.
Canonical path of `cwd`: the key of the current project's scoped state.
(display-label workspace)(display-label db-info workspace session)Human-facing label for workspace. Order: explicit :label →
pinned session title → id prefix.
Human-facing label for `workspace`. Order: explicit `:label` → pinned session title → id prefix.
(ensure-workspace! db-info {:keys [session-state-id]})Find-or-create the session's workspace. The DEFAULT is the bound project
folder (*workspace-root*), else the user's real cwd.
Resume returns whatever workspace the session was pinned to. Idempotent per
session-state.
Find-or-create the session's workspace. The DEFAULT is the bound project folder (`*workspace-root*`), else the user's real cwd. Resume returns whatever workspace the session was pinned to. Idempotent per session-state.
(env-filesystem-roots env-or-roots)Canonical [{:root}] entries available to the current tool call: the configured
workspace catalog entries and the immutable read/write roots from the environment
security snapshot. Catalog search: false roots are marked :no-search? with the
jail on or off. With the jail disabled, host filesystem roots are also granted and
marked no-search so explicit paths are unrestricted without making default
searches crawl the machine.
Reuse the entries while each input stays the same object. A workspace change swaps the workspace value, so the roots resolve again on the next call.
Canonical `[{:root}]` entries available to the current tool call: the configured
workspace catalog entries and the immutable read/write roots from the environment
security snapshot. Catalog `search: false` roots are marked `:no-search?` with the
jail on or off. With the jail disabled, host filesystem roots are also granted and
marked no-search so explicit paths are unrestricted without making default
searches crawl the machine.
Reuse the entries while each input stays the same object. A workspace change
swaps the workspace value, so the roots resolve again on the next call.(focus! db-info workspace-id)Stamp last_focused_at_ms and upsert the per-repo repo_focus
pointer. Returns the updated workspace record.
Stamp `last_focused_at_ms` and upsert the per-repo `repo_focus` pointer. Returns the updated workspace record.
(for-session db-info session-state-id)Workspace pinned to session-state-id, or nil.
Workspace pinned to `session-state-id`, or nil.
(get db-info workspace-id)Return the workspace with workspace-id, or nil.
Return the workspace with `workspace-id`, or nil.
(last-focused db-info repo-id)Workspace id from repo_focus for repo-id, or nil.
Workspace id from `repo_focus` for `repo-id`, or nil.
(list-active db-info repo-id)Active workspaces for repo-id, newest first.
Active workspaces for `repo-id`, newest first.
(list-active-with-sessions db-info repo-id)Like list-active but each entry is the {:workspace :session-state}
pair, sorted by last_focused_at_ms DESC NULLS LAST, then
created_at DESC.
Like `list-active` but each entry is the `{:workspace :session-state}`
pair, sorted by `last_focused_at_ms` DESC NULLS LAST, then
`created_at` DESC.(list-finished db-info repo-id)Discarded workspaces for repo-id, newest first.
Discarded workspaces for `repo-id`, newest first.
(no-search-roots)Canonical paths of bound filesystem roots flagged search: false in the
workspace catalog. resolve-search-roots prunes these from the DEFAULT grep
sweep; explicit paths still reach them.
Canonical paths of bound filesystem roots flagged `search: false` in the workspace catalog. `resolve-search-roots` prunes these from the DEFAULT grep sweep; explicit paths still reach them.
(normalize-config-sources sources)Validate a tier collection. Return nil for every tier, else the set of tiers. Throw a 400 error for an unknown tier.
Validate a tier collection. Return nil for every tier, else the set of tiers. Throw a 400 error for an unknown tier.
(normalize-root root)Canonicalize a workspace root string/File. Blank/nil → nil. Expand a leading
~ or ~/ against the current user's home directory.
Canonicalize a workspace root string/File. Blank/nil → nil. Expand a leading `~` or `~/` against the current user's home directory.
(repo-id-for root)Stable per-root grouping id (sanitized basename + path hash). Groups the workspaces of one root together in listings; no git involved.
Stable per-root grouping id (sanitized basename + path hash). Groups the workspaces of one root together in listings; no git involved.
(resolve-file-path p)Resolve a host file path with the same canonical root and always-access rules as the file tools. Bind workspace-root and filesystem-roots for the session before calling it.
Resolve a host file path with the same canonical root and always-access rules as the file tools. Bind *workspace-root* and *filesystem-roots* for the session before calling it.
(root-change-count)How many session roots moved in this process. Include it in a cache key that depends on session roots.
How many session roots moved in this process. Include it in a cache key that depends on session roots.
(session-config-sources db-info session-id)Tiers that session session-id reads, from its saved setting. Nil reads every tier.
Tiers that session `session-id` reads, from its saved setting. Nil reads every tier.
(set-label! db-info {:keys [workspace-id label]})Set the workspace's human-friendly :label. Empty/nil clears it.
Set the workspace's human-friendly `:label`. Empty/nil clears it.
(source-enabled? tier)True when the current session reads configuration tier tier.
True when the current session reads configuration tier `tier`.
(subdirs path)Child directory names (non-hidden) of path, case-insensitively sorted.
Empty vec when path is blank, not a directory, or unreadable.
Child directory names (non-hidden) of `path`, case-insensitively sorted. Empty vec when `path` is blank, not a directory, or unreadable.
(trunk-root)The user's real working directory — where they launched vis.
Canonical absolute path, never required to be a git repo.
(bin/vis-agent preserves the invocation cwd
as JVM user.dir even though it cd's to the repo for deps.)
The user's real working directory — where they launched `vis`. Canonical absolute path, never required to be a git repo. (`bin/vis-agent` preserves the invocation cwd as JVM user.dir even though it cd's to the repo for deps.)
(workspace-files root)Absolute paths of the files under root that git sees: tracked or untracked,
never ignored. nil when root is not in a Git working tree or git fails.
One listing answers every caller of the same root for workspace-files-ttl-ms,
and concurrent callers wait for the same listing. This is the one place where
extensions list a workspace, instead of a child process for each extension.
Absolute paths of the files under `root` that git sees: tracked or untracked, never ignored. nil when `root` is not in a Git working tree or git fails. One listing answers every caller of the same root for `workspace-files-ttl-ms`, and concurrent callers wait for the same listing. This is the one place where extensions list a workspace, instead of a child process for each extension.
(workspace-root env-or-root)Extract a canonical workspace root from an env map or raw root value.
For an env map, the live :workspace-atom wins over the static :workspace/root:
it always holds the session's saved workspace (#364).
Extract a canonical workspace root from an env map or raw root value. For an env map, the live `:workspace-atom` wins over the static `:workspace/root`: it always holds the session's saved workspace (#364).
(workspace-with-session db-info workspace-id)Hydrate workspace-id with its pinned session_state. Returns
{:workspace <ws> :session-state <ss>}.
Hydrate `workspace-id` with its pinned `session_state`. Returns
`{:workspace <ws> :session-state <ss>}`.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |