Add the slopo CLI adapter

Three things live here: where the plugin keeps its files, how it renders a
slopo config, and how it finds, installs and invokes the binary.

The adapter is driven by behaviour observed against slopo 0.8.0 rather than by
its documentation:

  * --config is a global option and must precede the subcommand
  * every path is written absolute, because slopo resolves relative paths
    against the process working directory, not against the config file
  * unknown config keys are a hard error, so the renderer writes from a closed
    allow-list
  * the embedding API key is never written at all -- slopo reads
    SLOPO_EMBEDDING_API_KEY from the environment ahead of the file, so the
    secret stays out of every file this plugin touches. Enforced in pruneConfig
    rather than at the call site, so no future caller can leak it by passing one.

explainFailure maps slopo's deliberately terse agent-facing messages onto a
message and a next step, and reads the log tail because stderr alone leaves the
agent with no move: on a real failure stderr said "Embedding failed." while the
log named the exact litellm parameter that was rejected.

installEnv redirects UV_TOOL_DIR, UV_TOOL_BIN_DIR and UV_PYTHON_INSTALL_DIR
into $DSH_HOME. Only two directories in this container are persistent mounts;
~/.local, where uv installs by default, is on the container's writable layer
and does not survive a recreation.
This commit is contained in:
dsh-slopo agent committed 2026-09-22 06:11:12 +01:00
1 parent 844f12faa3
commit e956a8c121
3 files changed
+287 -4

No files matched your search

+3 -3
View File
@@ -17,7 +17,7 @@ import { createHash } from 'node:crypto'
import { homedir } from 'node:os'
import { basename, join, resolve } from 'node:path'
/** Plugin name, used for the `$DSH_HOME/plugin-data/<name>` directory. */
/** Plugin name. Also the `$DSH_HOME/<name>` directory, matching graph-memory's shape. */
export const PLUGIN_NAME = 'dsh-slopo'
/** The dsh home directory: `$DSH_HOME`, else `~/.dsh`. */
@@ -44,12 +44,12 @@ export function workspaceKey(cwd) {
/** Per-workspace state: the slopo config, index database, ignore file and log. */
export function workspaceStateDir(dshHome, cwd) {
return join(dshHome, 'plugin-data', PLUGIN_NAME, 'workspaces', workspaceKey(cwd))
return join(pluginDataDir(dshHome), 'workspaces', workspaceKey(cwd))
}
/** Root of this plugin's own data, independent of any workspace. */
export function pluginDataDir(dshHome) {
return join(dshHome, 'plugin-data', PLUGIN_NAME)
return join(dshHome, PLUGIN_NAME)
}
/**